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 3 of 3

Thread: Error

  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Location
    Silver Spring
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error

    Hello out there to anyone that can help I am a new comer to javascripts and I am having the following error occur when my users run my page with the internet option for displaying script errors in iexplorer is on

    Error: 'document.form.total' iss null or not an object

    the function seems to be working fine as it does what it is supposed to do and the form os submitted with no problems (It also works well when the display script error option is turned off).

    function calculate()

    {

    document.form.total1.value = dp((document.form.subtotal.value))

    document.form.subtotal.value = dp(eval(document.form.total1.value))

    document.form.total.value = dp((document.form.subtotal.value))

    }

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    FL, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try document.forms[0]
    instead of document.form

    example: document.forms[0].total

    <form>
    <input type="text" name="total">
    </form>


    Hope this helps, It might stop the error
    CYWebmaster.com - See why we dot com!!
    ACJavascripts.com - Cut & Paste Javascripts!
    SimplyProgram.com - Personal Blog

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    Western US
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What is the name of the form? and does it have a filed named total?
    If the form is not named, or named "form" then that will cause the error. Check the name of the form, and if it is named form, rename it something else, and adjust the script. document.newFormName.total. You can also reference the form through an array document.form[0].total. If you have only one form on the page that will work as well, but if you add one above it you could still get an error. It's just easier to read if you use the form name.

    ShriekForth


  •  

    Posting Permissions

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