getting a document object from a form reference?

L

Llorenc Sole

Hello,

Is it possible to get a reference to a form's document object
exclusively from a reference to the same form? I mean, for example, if I
have:

var f1 = document.forms["form1"];
var f2 = parent.document.forms["form2"];
var f3 = top.document.forms["form3"];

Is it possible to get the document object of each form only from these
vars? Is there something like, i.e., a "form.document" property?

TIA,

Llorenc Sole
 
V

VK

Llorenc said:
Is it possible to get the document object of each form only from these
vars? Is there something like, i.e., a "form.document" property?

if ('undefined' != typeof myForm.ownerDocument) {
var doc = myForm.ownerDocument;
}

This property check only for ancient browsers. If you make environment
check somewhere else, then simply:

var doc = myForm.ownerDocument;
 
T

Thomas 'PointedEars' Lahn

VK said:
if ('undefined' != typeof myForm.ownerDocument) {
var doc = myForm.ownerDocument;
}

Reading this I thought you could get a posting right once. But:
This property check only for ancient browsers.
^^^^^^^^^^^^^^^^
Such as IE for Windows < 6.0, non-Windows IE, and Opera < 7.0, I suppose.
If you make environment check somewhere else, then simply:

var doc = myForm.ownerDocument;

Which is not any kind of check at all.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top