Javascript auto total on autofocus event

Javascript automatic Total of bill on Autofocus  event

Satish Dodia-mementotech
















Answer =



<html>
  <head>
        <title>MementoTech</title>
        <script language="javascript">
                function addNumbers()
                {
                        var val1 = parseInt(document.getElementById("value1").value);
                        var val3 = parseInt(document.getElementById("value12").value);

                        var val4 = parseInt(document.getElementById("value13").value);

                        var val5 = parseInt(document.getElementById("value14").value);

                        var val2 = parseInt(document.getElementById("value2").value);
                        var ansD = document.getElementById("answer");
                        ansD.value = val1 + val2 + val4 + val5 + val3;
                }
        </script>
  </head>
  <body>
        <input type="text" id="value1" name="value1"  onfocus="javascript:addNumbers()"/>
        <input type="text" id="value12" name="sa"  onfocus="javascript:addNumbers()"/>
        <input type="text" id="value13" name="ti"  onfocus="javascript:addNumbers()"/>
        <input type="text" id="value14" name="sh"  onfocus="javascript:addNumbers()"/>
      <input type="text" id="value2" name="value2"  onfocus="javascript:addNumbers()"/>
        <input type="button" name="Sumbit" value="Click here" onfocus="javascript:addNumbers()"/>
        Answer = <input type="text" id="answer" name="answer" value=""/>
  </body>

Post a Comment

0 Comments

Recent in Recipes

3/Food/post-list