Iframe question

M

mike

I have a document lets call it a.cfm that looks like:

<iframe src="" id="test" name="test"></iframe>

<div>
<form name="myform">
... many elements here
</form>
</div>

I open up a.cfm and my js changes the src of the iframe on the fly
between a couple different scripts lets call them x.cfm and y.cfm

2 questions:

1) In x.cfm I want to access the form elements in "myform".
Of course neither of these work:
if ( self.opener.document.myform.elements[] )
if ( document.myform.elements[] )

2) In x.cfm I want to see what parent iframe I opened up.
This doesn't work:
if (document.getElementByID('test') )

Can I not point inside either document I open up?

Mike
 
R

RobG

mike said:
I have a document lets call it a.cfm that looks like:

<iframe src="" id="test" name="test"></iframe>

<div>
<form name="myform">
... many elements here
</form>
</div>

I open up a.cfm and my js changes the src of the iframe on the fly
between a couple different scripts lets call them x.cfm and y.cfm

2 questions:

1) In x.cfm I want to access the form elements in "myform".
Of course neither of these work:
if ( self.opener.document.myform.elements[] )
if ( document.myform.elements[] )

2) In x.cfm I want to see what parent iframe I opened up.
This doesn't work:
if (document.getElementByID('test') )

Can I not point inside either document I open up?

Yes, you can. This thread should help:

<URL:http://groups.google.co.uk/group/co...that+my+content&rnum=1&hl=en#95db651f4ecd388d>
 
R

Randy Webb

mike said the following on 10/17/2005 8:09 PM:
I have a document lets call it a.cfm that looks like:

<iframe src="" id="test" name="test"></iframe>

<div>
<form name="myform">
... many elements here
</form>
</div>

I open up a.cfm and my js changes the src of the iframe on the fly
between a couple different scripts lets call them x.cfm and y.cfm

2 questions:

1) In x.cfm I want to access the form elements in "myform".
Of course neither of these work:
if ( self.opener.document.myform.elements[] )
if ( document.myform.elements[] )
parent.document.myform.elements[]

2) In x.cfm I want to see what parent iframe I opened up.
This doesn't work:
if (document.getElementByID('test') )

Of course not as test isn't in x.cfm

parent.document........
Can I not point inside either document I open up?

That depends on what you are calling "point insided either document".
 

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

Forum statistics

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

Latest Threads

Top