<html>
<head>
<script>
var total = document.frm.len.value * document.frm.wid.value;
function calculate()
{
alert(total);
}
</script>
</head>
<body>
<form name="frm">
<table>
<tr>
<td>Length</td>
<td><input type="text" name="len" /></td>
</tr>
<tr>
<td>Width</td>
<td><input type="text" name="wid" /></td>
</tr>
<tr>
<td><input type="button" name="Submit" value="Submit" onClick="calculate()" /></td>
</tr>
</table>
</form>
</body>
</html>
---------------------------------------------------------------------------
EDIT:
I got it, here's the results for those of you that want it:
<html>
<head>
<script>
function calculate(length, width)
{
alert(length.value * width.value);
}
</script>
</head>
<body>
<form name="frm">
<table>
<tr>
<td>Length</td>
<td><input type="text" name="len" /></td>
</tr>
<tr>
<td>Width</td>
<td><input type="text" name="wid" /></td>
</tr>
<tr>
<td><input type="button" name="Submit" value="Submit" onClick="calculate(document.frm.len, document.frm.wid)"
/></td>
</tr>
</table>
</form>
</body>
</html>
Edited by njr1489, 24 February 2009 - 07:35 PM.
Figured it out myself.


Sign In
Create Account


Back to top









