View Single Post
Old Nov 24th, 2006, 9:28 AM   #1
paulmedic555
Newbie
 
paulmedic555's Avatar
 
Join Date: Jan 2005
Location: Greece
Posts: 18
Rep Power: 0 paulmedic555 is on a distinguished road
Send a message via MSN to paulmedic555
simple multiply script

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?
paulmedic555 is offline   Reply With Quote