3
Reply

what is wrong with this code? thanks

azzo stones

azzo stones

Mar 15 2012 8:08 PM
2.1k

<html>
<head>
<center> <h1>  Petrol Calculator</h1></center>


<script language =" javascript">


 function writetext (form)
 {
 
   var KPL = form.inputbox.value;
   var Fuel = form.inputbox2.value;
   form.inputbox3.value =KPL * Fuel
 
 }


</script>
</head>
<body>
<form name = "myform">
Enter Petrol Milage<br>
<input type = "text" name = "inputbox" value = ""><p><br>
Enter Amount OF Fuel:<br>
<input type = "text" name = "inputbox2" value = ""><p><br>
KiloMeters To Travel:<br>
<input type = "text" name = "inputbox3" value = ""><p><br>

<input type = "button" name = "button" value = "Display KM" onclick ="writetext(this.form)">

</body>
</html>


Answers (3)