| One of the big questions people have is how they
can pass values from fields to others fields.
Take a look this sample. Field C = A X B. User want to get result
C automatically.
Here is the code:
<script language="JavaScript">
function calculate()
{
A1 = document.catalog_form.a1.value
B1 = document.catalog_form.b1.value
C1 = (A1*B1)
document.catalog_form.c1.value = C1
}
</script>
<html>
<body>
<form name="catalog_form">
<input type="text" name="a1">
X
<input type="text" name="b1" onChange=calculate();>
=
<input type="text" name="c1" >
</form> </body>
</html>
|