[Javascript] referring to a form in a div

Andrew Gibson andyg at ihug.co.nz
Tue May 1 15:20:00 CDT 2001


 > Here's another one:
 >
 >     How do you refer to the form inside a DIV tag (particularly
 > one that's
 > absolutely positioned, although that shouldn't make a
 > difference)?  I can't
 > seem to get it right for NN or IE.

//  where myelement could be a text box say
// and you have a form called "myform" and a div called "mydiv"

//for IE I use
var mytxt=document.forms['myform'].myelement.value;

//for NS
var mytxt=document.layers['mydiv'].document.forms['myform'].myelement.value;

Andrew





More information about the Javascript mailing list