weili
weili

Reputation: 51

Regarding javascript document.forms[]

If I have a piece of javascript code in my jsp (as shown below):

If var frmObj=document.forms['cseeForm'];

and I did not create a form named cseeForm in that jsp, does the above code means: create a new form called cseeForm? and assign it to frmObj?

Please help, I am maintaining a web application, but I could not find any form object named cseeForm in that jsp.

Upvotes: 1

Views: 395

Answers (1)

Adam Rackis
Adam Rackis

Reputation: 83356

document.forms simply returns a collection of the forms that currently exist. So, if you haven't created a form with that name, then

var frmObj = document.forms['cseeForm'];

will simply assign undefined to frmObj; no new form will be created.

For more information, check out the relevant MDN page on document.forms

Upvotes: 3

Related Questions