View Single Post
Old Nov 24th, 2006, 12:10 PM   #3
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
Yes i didn't copy it correctly.I was missing a logical "or" operator between the expressions of "if".Now it works :
<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>
<p><input type="button" name="calculate" value="calculate" onclick=convert(this.form)></p>
<p>Result:<input type="text" name="result" value="not calculated" ></p><br>
</form>
Sorry for the stupid post
paulmedic555 is offline   Reply With Quote