tarun
03-10-2007, 04:27 PM
Hi everyone,
I am tarun, and i am very new to javascript coding. Recently i have been working on this one code that wuould convret and tell you what you wud weigh on othe planets when the visiotor gives you his weight in an input box. so far i have this much and it doesnt seem to work, i think i know there is sumthing wrong with the onClick button,,but anywyas can any one please tell me whats wrong with it. Here is the code
<html>
<head>
<title> Find your weight on other planets </title>
<script>
function candy (form.ans.value)
{
a=eval(form.w.value)
b=(10*a*1.66)/10
form.moon.value=b
}
</script>
</head>
<body>
<form name=form>
<table>
<tr>
<td> Enter your weight here: <input type=text value="" name=w> </td>
</tr>
<tr>
<td> Click here to see what you weigh on other planets: <input type=button value="Click for your results" onClick="ans(this.form)"> </td>
</tr>
<tr>
<td> Click here to reset: <input type=reset value="Reset"><p> </td>
</tr>
<tr>
<td> Moon: <input type=text value="" name=moon> </td>
</tr>
</table>
</form>
</body>
</html>
any help would be greatly appreciated!!!
I am tarun, and i am very new to javascript coding. Recently i have been working on this one code that wuould convret and tell you what you wud weigh on othe planets when the visiotor gives you his weight in an input box. so far i have this much and it doesnt seem to work, i think i know there is sumthing wrong with the onClick button,,but anywyas can any one please tell me whats wrong with it. Here is the code
<html>
<head>
<title> Find your weight on other planets </title>
<script>
function candy (form.ans.value)
{
a=eval(form.w.value)
b=(10*a*1.66)/10
form.moon.value=b
}
</script>
</head>
<body>
<form name=form>
<table>
<tr>
<td> Enter your weight here: <input type=text value="" name=w> </td>
</tr>
<tr>
<td> Click here to see what you weigh on other planets: <input type=button value="Click for your results" onClick="ans(this.form)"> </td>
</tr>
<tr>
<td> Click here to reset: <input type=reset value="Reset"><p> </td>
</tr>
<tr>
<td> Moon: <input type=text value="" name=moon> </td>
</tr>
</table>
</form>
</body>
</html>
any help would be greatly appreciated!!!