0

I cannot calculate all total amout about this..How can i do it.??
here is coding:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript">
function startCalc(){
  interval = setInterval("calc()",1);
}
	function calc(){
 		 one = document.order_form_10.dish1.value;
  		document.order_form_10.totaldish1.value = one * 10 ;
}
function startCalc2(){
  interval = setInterval("calc2()",1);
}

function calc2(){
  one = document.order_form_10.dish2.value;
    document.order_form_10.totaldish2.value = one * 15 ;
}
function startCalc3(){
  interval = setInterval("calc3()",1);
}

function calc3(){
  one = document.order_form_10.dish3.value;
  document.order_form_10.totaldish3.value = one * 20 ;
}
function startCalc4(){
  interval = setInterval("calc4()",1);
}

function calc4(){
  one = document.order_form_10.dish4.value;
  document.order_form_10.totaldish4.value = one * 25 ;
  }
function startCalc5(){
  interval = setInterval("calc5()",1);
}
	function calc5(){
 		 one = document.order_form_10.dish5.value;
  		document.order_form_10.totaldish5.value = one * 30 ;
}  
 function startCalc6(){
  interval = setInterval("calc6()",1);
}
	function calc6(){
 		 one = document.order_form_10.dish6.value;
		document.order_form_10.totaldish6.value = one * 35 ;
		}  

function stopCalc(){
  clearInterval(interval);
}

function validateForm(theForm)
{
	
	if (!validRequired(theForm.username,"User Name"))
		return false;
	return true;
}
function validRequired(formField,fieldLabel)
{
	var result = true;
	
	if (formField.value == "")
	{
alert('Please fill the"' + fieldLabel +'" part (cebit-xxxxxxx).');
		formField.focus();
		result = false;
	}
	
	return result
}


</script>

</head>

<body>
<form name="order_form_10" action="order_form_10_rtn.asp" method="post">

 <center> <h4>SALES ORDER</h4></center>
  <table width="645" height="400" border="4" bordcolor="black" cellpadding="2" align=center>
    <tr>
      <td width="144" height="34"><strong>Product</strong></td>
      <td width="69"><strong>Quantity</strong></td>
      <td width="144"><strong>Total Price</strong></td>
    </tr>
    <tr>
      <td>Wedding Brooch</td>
      <td>RM10.00
        <input name="dish1" type="text" size="10" onFocus="startCalc();" 

onBlur="stopCalc();"></td>
      <td><input type="text" name="totaldish1"></td>
    </tr>
    <tr>
      <td>Kristal Brooch</td>
      <td>RM15.00
        <input name="dish2" type="text" size="10" onFocus="startCalc2();" 

onBlur="stopCalc2();"></td>
      <td><input type="text" name="totaldish2"></td>
    </tr>
    <tr>
      <td>Kristal Brooch</td>
      <td>RM20.00
        <input name="dish3" type="text" size="10" onFocus="startCalc3();" 

onBlur="stopCalc3();"></td>
      <td><input type="text" name="totaldish3"></td>
    </tr>
    <tr>
      <td>Kristal Brooch</td>
      <td>RM25.00
        <input name="dish4" type="text" size="10" onFocus="startCalc4();" 
onBlur="stopCalc4();"></td>
      <td><input type="text" name="totaldish4"></td>
    </tr>
    <tr>
     <td>Kristal Brooch</td>
      <td>RM30.00
        <input name="dish5" type="text" size="10" onFocus="startCalc5();" 
onBlur="stopCalc5();"></td>
      <td><input type="text" name="totaldish5"></td>
    </tr>
    <tr>
      <td>Kristal Brooch</td>
      <td>RM35.00
        <input name="dish6" type="text" size="10" onFocus="startCalc6();" 
onBlur="stopCalc6();"></td>
      <td><input type="text" name="totaldish6"></td>
    </tr>  
</table>

<p>
   <center> <label for="total"></label>
  <strong>Total Amout (RM): </strong></p>
  <label for="total2"></label>
  <input type="text" name="total" id="total2"></center>
</br>
<center>
<input type="reset" name="Reset" value="Clear">
</center>
</form>

</body>
</html>

Edited by Ezzaral: Added code tags. Please use them to format all code that you post.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by MartinRinehart
0

What, in English (not code) are you doing?

Also, use functions to call 'setTimeout( function_not_string, millis )'

function do_foo() { /* does something here */ }

// wrong:
setTimeout( 'do_foo()', 1000 ); //string is bad

// right:
setTimeout( do_foo, 1000 ); // function is good

The function will be called after a lapse of approximately the millis you specify.

Debugging anything with a one milli interval is probably impossible. Start with 1000.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.