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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    my last code ever, PLLZZZ HELP!!!

    i dont think its problem with syntax, i think its the order of the code. but this is the last program i have to do ever for college and i cant figure it out. last day is tommorow and i can't figure out what im doing wrong. i just need to be able to enter the information and have the 3 calculations execute and move the information to the right column. the mathematical calculations are to figure out the tax. but if anyone sees anything wrong could you please tell me what, thanks a lot.
    i do the form code first, than call a function on the submit button, but the information won't transfer..



    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> Car Registration </TITLE>

    </HEAD>
    <BODY bgcolor=tan test=black>
    <h1><center><b>NJDMV - Trenton NJ</b></center>
    <hr><hr>
    </h1>
    <center>

    <form name=carForm>
    <table border=4>
    <tr>
    <td></td>
    <td><center>INPUT</td>
    <td><center>OUTPUT</td>
    </tr>
    <tr>
    <td>Owner</td>
    <td><input type="text" name="ownerIn"></td>
    <td><input type="text" name="ownerOut"></td>
    </tr>
    <tr>
    <td>Vehicle Model</td>
    <td><input type="text" name="modelIn"></td>
    <td><input type="text" name="modelOut"></td>
    </tr>
    <tr>
    <td>Vehicle Type</td>
    <td><input type="text" name="TypeIn"></td>
    <td><input type="text" name="TypeOut"></td>
    </tr>
    <tr>
    <td>VehicleWeight</td>
    <td><input type="text" name="weightIn"></td>
    <td><input type="text" name="weightOut"></td>
    </tr>
    <tr>
    <td>Type Use</td>
    <td><input type="text" name="useIn"></td>
    <td><input type="text" name="useOut"></td>
    </tr>
    <tr>
    <td>Price</td>
    <td><input type="text" name="priceIn"></td>
    <td><input type="text" name="priceOut"></td>
    </tr>
    <tr>
    <td>Registration</td>
    <td></td>
    <td><input type="text" name="regOut"></td>
    </tr>
    <tr>
    <td>Tax Levy</td>
    <td></td>
    <td><input type="text" name="levyOut"></td>
    </tr>
    <tr>
    <td>Weight Tax</td>
    <td></td>
    <td><input type="text" name="wtaxOut"></td>
    </tr>
    <tr>
    <td>Insurance</td>
    <td></td>
    <td><input type="text" name="insOut"></td>
    </tr>
    <tr>
    <td>Registration Cost</td>
    <td></td>
    <td><input type="text" name="rCostOut"></td>
    </tr>
    <tr>
    <td>Federal Tax</td>
    <td></td>
    <td><input type="text" name="fTaxOut"></td>
    </tr>
    <tr>
    <td>Total Due</td>
    <td></td>
    <td><input type="text" name="totalOut"></td>
    </tr>
    <tr>
    <td></td>
    <td><center><input type="button" value="SUBMIT"
    onClick="carFunction()"></td>
    </tr>
    </table>
    </form>
    <script>
    var ownerIn
    var ownerOut
    var modelIn
    var modelOut
    var typeIn
    var typeOut
    var weightIn
    var weightOut
    var useIn
    var useOut
    var priceIn
    var priceOut
    var regOut
    var levyOut
    var wtaxOut
    var insOut
    var rCostOut
    var fTaxOut
    var totalOut
    function carFunction()
    {
    fTaxOut=priceIn*.02
    }
    if (ownerIn="P")
    {
    levyOut=priceIn*.05
    wtaxOut=weightIn*.01
    inOut=priceIn*.01
    }
    else
    {
    levyOut=priceIn*.07
    wtaxOut=weightIn*.03
    inOut=priceIn*.02
    }
    regOut=levyOut+wtaxOut+inOut
    totalOut=fTaxOut+regOut
    ownerOut=Document.carForm.ownerIn.value.
    modelOut=Document.carForm.modelIn.value.
    typeOut=Document.carForm.typeIn.value.
    weightOut=Document.carForm.weightIn.value.
    useOut=Document.carForm.useIn.value.
    priceOut=Document.carForm.priceIn.value.
    regOut=Document.carForm.regOut.value.
    levyOut=Document.carForm.levyOut.value.
    wtaxOut=Document.carForm.wtaxOut.value.
    insOut=Document.carForm.insOut.value.
    rCostOut=Document.carForm.rCostOut.value.
    fTaxOut=Document.carForm.fTaxOut.value.
    totalOut=Document.carForm.totalOut.value.
    </script>
    </BODY>
    </HTML>

  • #2
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    and you definently made need to transfer into editplus or something to run the program so you can understand it what it does.. thanks again.

  • #3
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i guess noone can figure out why its not working.. bump

  • #4
    New Coder bigtiger's Avatar
    Join Date
    Oct 2005
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi, take a look of this

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> Car Registration </TITLE>
    </HEAD>
    <BODY bgcolor=tan test=black>
    <h1><center><b>NJDMV - Trenton NJ</b></center>
    <hr><hr>
    </h1>
    <center>

    <form name=carForm>
    <table border=4>
    <tr>
    <td></td>
    <td><center>INPUT</td>
    <td><center>OUTPUT</td>
    </tr>
    <tr>
    <td>Owner</td>
    <td><input type="text" name="ownerIn"></td>
    <td><input type="text" name="ownerOut"></td>
    </tr>
    <tr>
    <td>Vehicle Model</td>
    <td><input type="text" name="modelIn"></td>
    <td><input type="text" name="modelOut"></td>
    </tr>
    <tr>
    <td>Vehicle Type</td>
    <td><input type="text" name="TypeIn"></td>
    <td><input type="text" name="TypeOut"></td>
    </tr>
    <tr>
    <td>VehicleWeight</td>
    <td><input type="text" name="weightIn"></td>
    <td><input type="text" name="weightOut"></td>
    </tr>
    <tr>
    <td>Type Use</td>
    <td><input type="text" name="useIn"></td>
    <td><input type="text" name="useOut"></td>
    </tr>
    <tr>
    <td>Price</td>
    <td><input type="text" name="priceIn"></td>
    <td><input type="text" name="priceOut"></td>
    </tr>
    <tr>
    <td>Registration</td>
    <td></td>
    <td><input type="text" name="regOut"></td>
    </tr>
    <tr>
    <td>Tax Levy</td>
    <td></td>
    <td><input type="text" name="levyOut"></td>
    </tr>
    <tr>
    <td>Weight Tax</td>
    <td></td>
    <td><input type="text" name="wtaxOut"></td>
    </tr>
    <tr>
    <td>Insurance</td>
    <td></td>
    <td><input type="text" name="insOut"></td>
    </tr>
    <tr>
    <td>Registration Cost</td>
    <td></td>
    <td><input type="text" name="rCostOut"></td>
    </tr>
    <tr>
    <td>Federal Tax</td>
    <td></td>
    <td><input type="text" name="fTaxOut"></td>
    </tr>
    <tr>
    <td>Total Due</td>
    <td></td>
    <td><input type="text" name="totalOut"></td>
    </tr>
    <tr>
    <td></td>
    <td><center><input type="button" value="SUBMIT"
    onClick="carFunction()"></td>
    </tr>
    </table>
    </form>
    <script type="text/javascript">
    var ownerIn
    var ownerOut
    var modelIn
    var modelOut
    var typeIn
    var typeOut
    var weightIn
    var weightOut
    var useIn
    var useOut
    var priceIn
    var priceOut
    var regOut
    var levyOut
    var wtaxOut
    var insOut
    var rCostOut
    var fTaxOut
    var totalOut
    function carFunction()
    {
    fTaxOut=priceIn*.02

    if (ownerIn="P")
    {
    levyOut=priceIn*.05
    wtaxOut=weightIn*.01
    inOut=priceIn*.01
    }
    else
    {
    levyOut=priceIn*.07
    wtaxOut=weightIn*.03
    inOut=priceIn*.02
    }
    regOut=levyOut+wtaxOut+inOut;
    totalOut=fTaxOut+regOut;
    ownerOut=document.carForm.ownerIn.value;
    modelOut=document.carForm.modelIn.value;
    typeOut=document.carForm.TypeIn.value;
    weightOut=document.carForm.weightIn.value;
    useOut=document.carForm.useIn.value;
    priceOut=document.carForm.priceIn.value;
    regOut=document.carForm.regOut.value;
    levyOut=document.carForm.levyOut.value;
    wtaxOut=document.carForm.wtaxOut.value;
    insOut=document.carForm.insOut.value;
    rCostOut=document.carForm.rCostOut.value;
    fTaxOut=document.carForm.fTaxOut.value;
    totalOut=document.carForm.totalOut.value;

    // this line was added by me //
    document.carForm.ownerOut.value = ownerOut;
    }
    </script>
    </BODY>
    </HTML>
    You can check this thread if you are not family with it:
    JavaScript - Frequently Asked Questions

    Hope this help !!!

  • #5
    Regular Coder
    Join Date
    Sep 2005
    Location
    Chicago, IL
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's some ideas:

    1. <form name="carForm"> - its always a good idea to put quotations around the name of any element.

    2. <input type="text" name="TypeIn"> and then you use 'var typeIn' - javascript is case sensitive.

    3. 'ownerOut=Document.carForm.ownerIn.value.' - i'm not sure what the period after value is supposed to do but you should use a semi-colon ( there to let javascript know its the end of a line.

    4. Debug your stuff using FireFox browser and the JavaScript console included. It will usually give you a good idea of whats wrong.

    I never tested the code, but those are some decent ideas to get you started.
    I'm only telling you how I would do it, not how its supposed to be done. ;)

  • #6
    Regular Coder
    Join Date
    Sep 2005
    Location
    Chicago, IL
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh yeah that winking smilie face was definetly just supposed to be a semi-colon ';'.
    I'm only telling you how I would do it, not how its supposed to be done. ;)


  •  

    Posting Permissions

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