Set Document Object

S

Sisilla

Hello All,

Hopefully, this is not a totally moronic question, but is there a way
to change the document object referred to by the 'document' keyword?
(I hope that made sense...)

After I submit a form in frame1 that has frame2 as its target, I would
like to refer back to elements in frame1 using
'document.getElementById...'. instead of using
'parent.frame1.document...'. Is there any way to accomplish this?

I appreciate any help. Thank you for your time and consideration.

Sincerely,

Sisilla
 
M

Martin Honnen

Sisilla said:
After I submit a form in frame1 that has frame2 as its target, I would
like to refer back to elements in frame1 using
'document.getElementById...'. instead of using
'parent.frame1.document...'. Is there any way to accomplish this?

Well you could do
var document = parent.frame1.document;
but you lose access to the original document that way so I don't think
it is a good idea.
If you want to save on typing then do e.g.
var doc = parent.frame1.document;
and use the doc variable
 
S

Sisilla

   var document = parent.frame1.document;

Thanks a bunch, Martin. Exactly what I needed. ~Sisilla
 
E

Evertjan.

Martin Honnen wrote on 15 feb 2008 in comp.lang.javascript:
Well you could do
var document = parent.frame1.document;
but you lose access to the original document that way so I don't think
it is a good idea.
If you want to save on typing then do e.g.
var doc = parent.frame1.document;
and use the doc variable

var response = document;
response.write('blablah');

The above is very nice for testing some serverside intended js code
in a browser.
 
A

Aditya

Thanks a bunch, Martin. Exactly what I needed. ~Sisilla

dude i always thought document was a read-only reference to the DOM
root
....and probably my firefox still thinks so....coz this didn't work as
i had expected....
r u sure u can alter the reference held by document keyword
 

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
473,792
Messages
2,569,639
Members
45,351
Latest member
RoxiePulli

Latest Threads

Top