View Full Version : Error

08-02-2002, 04:45 PM
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))


08-02-2002, 04:49 PM
try document.forms[0]
instead of document.form

example: document.forms[0].total

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

Hope this helps, It might stop the error :D:D

08-02-2002, 04:51 PM
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.