Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Billing System through Javascript

    Code:
    <table width="462" border="0" align="center">
                <tr>
                  <td height="26" align="left"><span class="style9">No.</span></td>
                  <td align="left"><span class="style9">description</span></td>
                  <td align="left"><span class="style9">qty</span></td>
                  <td align="left"><span class="style9">unit</span></td>
                  <td align="left"><span class="style9">total</span></td>
                </tr>
                <tr>
                  <td width="57" height="26" align="left"><input type="text" size="5" name="d10" /></td>
                  <td width="187" align="left"><input type="text" size="25" name="d" /></td>
                  <td width="58" align="left"><input type="text" size="25" name="d2" /></td>
                  <td width="89" align="left"><input type="text" size="25" name="d3" /></td>
                  <td width="49" align="left"><input type="text" size="25" name="d4" /></td>
                </tr>
                <tr>
                  <td height="26" align="left"><input type="text" size="5" name="d15" /></td>
                  <td align="left"><input type="text" size="25" name="d" /></td>
                  <td align="left"><input type="text" size="25" name="d8" /></td>
                  <td align="left"><input type="text" size="25" name="d5" /></td>
                  <td align="left"><input type="text" size="25" name="d11" /></td>
                </tr>
                <tr>
                  <td height="26" align="left"><input type="text" size="5" name="d16" /></td>
                  <td align="left"><input type="text" size="25" name="d" /></td>
                  <td align="left"><input type="text" size="25" name="d9" /></td>
                  <td align="left"><input type="text" size="25" name="d6" /></td>
                  <td align="left"><input type="text" size="25" name="d12" /></td>
                </tr>
                <tr>
                  <td height="26" align="left"><input type="text" size="5" name="d17" /></td>
                  <td align="left"><input type="text" size="25" name="d172" /></td>
                  <td align="left" bgcolor="#FFFFFF"><input type="text" size="25" name="d173" /></td>
                  <td align="left"><input type="text" size="25" name="d7" /></td>
                  <td align="left"><input type="text" size="25" name="d13" /></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="2" class="style7">&nbsp;</td>
                  <td>&nbsp;</td>
                  <td><span class="style7">Grand Total </span></td>
                  <td><input type="text" size="25" name="d14" /></td>
                </tr>
                <tr>
                  <td colspan="5" align="center"><input type="submit" name="submit" value="Add Invoice" /></td>
                </tr>
              </table>



    Here i post code and img both.
    i want that i only write quantity and unit. Total and Grand Total will automatic change .
    please send me full code of javascript

    thank you
    Last edited by ApniGang; 05-15-2009 at 12:29 PM.

  • #2
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Location
    Dundee, Scotland
    Posts
    378
    Thanks
    9
    Thanked 39 Times in 39 Posts
    Hmm, this sounds a little bit like a homework assignment.

    I'll give you a clue. You need to think about adding onchange events to some of the text boxes and write a function to handle those changes.

    Even if this is not homework, I would suggest that asking "please send me full code of javascript" is not the best way to get a reply.

    good luck!
    Regards, Stooshie
    O

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,918
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    You will also need to validate that the user entries for qty and unit (what is that?) are valid numbers within an acceptable range.

  • #4
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <script language="javascript" type="text/javascript">
    
    function addd() {
      document.addem.input1.value= ""
      document.addem.input2.value= ""
        document.addem.input3.value= ""
    	  document.addem.input4.value= ""
    }
    
    function addthem() {
        //FIRST INPUT VALUE
        var add1 = document.addem.input1.value
        var add1 = parseFloat(add1, 10)
        add1 = (isNaN(add1))?0:add1;
    
        //SECOND INPUT VALUE
        var add2 = document.addem.input2.value
        var add2 = parseFloat(add2, 10)
        add2 = (isNaN(add2))?0:add2;
    	
    	 //Third INPUT VALUE
        var add3 = document.addem.input3.value
        var add3 = parseFloat(add3, 10)
        add3 = (isNaN(add3))?0:add3;
    
        //Four INPUT VALUE
        var add4 = document.addem.input4.value
        var add4 = parseFloat(add4, 10)
        add4 = (isNaN(add4))?0:add4;
        
        //ADD THEM TOGETHER
        return eval(add1) * eval(add2);
    	
    	 //ADD THEM TOGETHER
        return eval(add3) * eval(add4);
    }
    
    function addition() { document.addem.answer.value = addthem() }
    function additions() { document.addem.answer2.value = addthem() }
    
    </script>
    here is JavaScript code. the first line of qty and unit working but second link of qty and unit giving same answer of first line .
    please tel me the correct code

    thank you


  •  

    LinkBacks (?)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •