Hi all our teacher gave us this simple script that when someone gives two numbers in two forms then it will multiply their contents and print the result in an another form after he click one button.Here is the code:
<script language="javascript">
function convert (form)
{
if ((form.first.value == "")
(form.second.value ==""))
return;
form.result.value=form.first.value * form.second.value;
}
</script> and
<form method="post">
Give first number:<input type="text" name="first" value=0 onchange=convert(this.form)>
<p>Give second number:<input type="text" name="second" value=0 onchange=convert(this.form)>
<p><input type="button" name="calculate" value="calculate" onclick=convert(this.form)>
<p>Result:<input type="text" name="result" value="not calculated" ><br>
</form>
I only tried in firefox and it didn't work.Any ideas?