A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Engineering
»
HTML, CSS and JavaScript
Author
Execute the Code
Arun C. Giridharan
Ranch Hand
Joined: Jul 11, 2010
Posts: 96
posted
Aug 16, 2010 10:38:35
0
<html> <head> <script type="text/javascript"> function product(a,b) { return a*b; } </script> </head> <body> <script type="text/javascript"> <input type="button" value="Click me" onclick=document.write(product(4,3))/>; </script> <p>The script in the body section calls a function with two parameters (4 and 3).</p> <p>The function will return the product of these two parameters.</p> </body> </html>
document.write(product(4,3)) i'm not able to execute the code...i don't know what is the problem???
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15229
I like...
posted
Aug 16, 2010 10:59:13
0
Did you leave the quotes off your on click handler on purpose?
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
Aug 16, 2010 11:05:56
0
And what would a document.write mean after the document has been rendered?
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
13
I like...
posted
Aug 16, 2010 11:16:29
0
Arun Giridharan wrote:
i'm not able to execute the code
Please read
TellTheDetails
and
ItDoesntWorkIsUseless
.
And David is correct, document.write() is most certainly not what you want to be doing.
[
Smart Questions
] [
JSP FAQ
] [
Books by Bear
] [
Bear's FrontMan
] [
About Bear
]
I agree. Here's the link:
http://zeroturnaround.com/jrebel
subject: Execute the Code
Similar Threads
Just trying using Object Oriented technique in Javascript but the output not displyed in brwser
Not able to hide a sentence using jquery
Javascript function isn't returning a value
executing a javascript function from a servlet
Why to use eval function inside Javascript
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter