below is the javascript that works ok. but i was wanting to assign a variable directly
and as yet i can not can any on tell me what i am doing wrong surround area in question with caps
[HTML]<script language="JavaS cript">
function calculateArea(n um1)
{
num2 = num1*2
return num2
}
</script>
</head>
<body>
<form name ="myForm">[/HTML]
THE LINE BELOW HERE IS WHAT I WANT TO REPLACE
put number in this box[HTML]<input type="text" name="num1" value="">
[/HTML]
WHAT I WANT IS SOMETHING LIKE THIS var num1=5; but it does not work?
[HTML]<br><br><br>
<input type="button" value="clik to multiply number by 2"
onClick ="document.myFo rm.num2.value = calculateArea(n um1.value)">
<br/><br><br>
number * 2 will appear here <input name="num2" value="">
</form>
</body> </html>[/HTML]
and as yet i can not can any on tell me what i am doing wrong surround area in question with caps
[HTML]<script language="JavaS cript">
function calculateArea(n um1)
{
num2 = num1*2
return num2
}
</script>
</head>
<body>
<form name ="myForm">[/HTML]
THE LINE BELOW HERE IS WHAT I WANT TO REPLACE
put number in this box[HTML]<input type="text" name="num1" value="">
[/HTML]
WHAT I WANT IS SOMETHING LIKE THIS var num1=5; but it does not work?
[HTML]<br><br><br>
<input type="button" value="clik to multiply number by 2"
onClick ="document.myFo rm.num2.value = calculateArea(n um1.value)">
<br/><br><br>
number * 2 will appear here <input name="num2" value="">
</form>
</body> </html>[/HTML]
Comment