1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Problem in Subtraction

Discussion in 'PHP' started by newphpcoder, Dec 9, 2010.

  1. newphpcoder

    newphpcoder New Member

    this codes:
    HTML:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <script type= "text/javascript"> 
    function startCalc(){
      interval = setInterval("calc()",1);
        }
    function calc(){
        var qty = new Array(2);
        qty[0] = parseFloat(document.myform.inqty.value);
      qty[1] = parseFloat(document.myform.outqty.value);
      
    myqtyval = qty[0]-qty[1];
    document.myform.myqty.value = myqtyval;    
    }
     
    function stopCalc(){
      clearInterval(interval);
    }
    </script>
    </head>
    <body>
    <form name='myform' action='test.php' method='post'>
    Input<input type='text' name='inqty'  onFocus='startCalc();' onBlur='stopCalc();' />
    Output<input type='text' name='outqty'  onFocus='startCalc();' onBlur='stopCalc();' /><br/>
    myqty<input type='text' name='myqty' value=''  />
    <input type='submit' name='submit' value='save' />
     
     
    </form>
    </body>
    </html>
    
    has the concept of what i want that after i insert number in output the result was automatically appear in qty but the problem in this code it did not use on key enter and I don't know how can i put that code n my php file where I attach.
    I'm sorry, i do understand the concept but I don't know how can I code it and where i can put the codes.

    Thank you..
     

Share This Page