473,506 Members | 17,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting a document object from a form reference?

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
Feb 22 '06 #1
3 1392
VK

Llorenc Sole wrote:
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;

Feb 22 '06 #2
Hi,
var doc = myForm.ownerDocument;


Wow, exactly what I was looking for. Thank you!

Llorenc
Feb 22 '06 #3
VK wrote:
Llorenc Sole wrote:
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;
}


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
Feb 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3399
by: mark.reichman | last post by:
I have text fields in my form with the same name. I can reference the value of these fields in IE 6.0 like with document.form.field.value. However, netscape 4.7 seems to croak. Why? What is the...
4
13374
by: Don W. | last post by:
Is it possible to open a browser window from a javascript for the purpose of gathering user input on a form and then use data from the form in the javascript? How do you get the data from the form...
10
2293
by: Chuck | last post by:
Hi! Any ideas as to how I can get ride of the script error undefined variable "Exp_Month"? I am trying to get this drop down list to default to the current month as opposed to 01. Thank...
6
22489
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object...
12
10124
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical...
15
3286
by: lawrence | last post by:
Is this the correct way to test for a method before I use it? createRange() is, I believe, an IE only method. function wrapSelectionInTag(selection, tag) { if (document.selection.createRange)...
21
3930
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
4
4561
by: chippy | last post by:
I am finding that when I use the cloneNode method to copy an HTML element that contains a <script> tag, the contents of the <script> tag, (ie. the javascript) are removed. If I do this: var...
0
7220
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7479
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.