Why in jsp the scripts shows error on

document.forms[0].[fieldname].length

throws object required error with IE if we written the script above the <form>. But this error will not come if the script is written below the form. anybody know why this error happening?

Thanks in advance..

When written above the form, the script tries to access an element which isn't there i.e. since the form hasn't been yet created, there is no form element whose fieldname you can access. When written below, it obviously works as expected.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.