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 Coder
    Join Date
    Feb 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Newbie at javascript

    I am very new to JavaScript and am trying to create a page that calculate net annual pay and pops up an alert box that states what they will take home as well as pay in taxes. I have figured my way out of created the boxes to enter fields and even got a calculate button. I cannot figure out the code the actually calculate the taxes!

    Field one is for first name and referenced by id: num1
    Field two is for last name and referenced by id: num2
    Field three is enter gross salary with id: num3

    I am using 20% for federal taxes and 10% for state taxes and need it to show up in an alert box... Any ideas? Thanks!

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    Show your code. We will not do your homework for you, but if you make a substantial effort yourself then doubtless someone will help you correct/improve it.

    Do please read the posting guidelines regarding silly thread titles. The thread title is supposed to help people who have a similar problem in future. Yours is useless for this purpose. You can (and should) edit it to make it more meaningful.


    It is your responsibility to die() if necessary….. - PHP Manual

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    New Coder
    Join Date
    Feb 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <form action="" method="post" name="math_form">
    <p> Enter your First Name:
    <input name="num1" type="text" id="num1" size="10" maxlength="10">
    </p>

    <p> Enter your Last Name:
    <input name="num2" type="text" id="num2" size="10" maxlength="10">
    </p>

    <p> Enter your gross salary:
    <input name="num3" type="text" id="num3" size="10" maxlength="10">
    </p>


    <FORM>

    Click this button to calulate your annual net pay!
    <INPUT NAME="calc" VALUE="Calculate" TYPE=BUTTON
    onClick=temp(this.form)>
    <p>

    </FORM>

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    And your Javascript? Once again - we will not do your homework for you, but if you make a substantial effort yourself then doubtless someone will help you correct/improve it. See forum rule #1.5.

    You have two <form> tags. Where is the result of your calculation to appear?

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Posting Permissions

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