473,385 Members | 1,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Iframe question

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

Oct 18 '05 #1
3 1489
mike wrote:
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/comp.lang.javascript/browse_frm/thread/4fb05ca84e7ede6e/95db651f4ecd388d?q=get+the+id+of+the+iframe+that+m y+content&rnum=1&hl=en#95db651f4ecd388d>
--
Rob
Oct 18 '05 #2
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".

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 18 '05 #3
Super guys ..... Thanks to both, works like a charm !

Oct 18 '05 #4

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

Similar topics

4
by: Thomas | last post by:
Hi there, I have an iframe which is editable (designMode = "on") and want to resize it dynamically as the content grows (e.g. more lines of text is in there) and there the struggle starts. I...
3
by: Alexandre Jaquet | last post by:
Hi I wanna know how can I reload an iframe does I've to move my iframe into another form an do a submit or may I can do it by another way rigth now I'm been doing : my form name is mainform...
6
by: SF RVN | last post by:
I have searched NUMEROUS sources in an effort to find the magic (script, styles, syntax, etc.) that will allow me to create a web page with the following format: ...
7
by: Patrick.O.Ige | last post by:
Can i use Frameset in ASP.NET?What are other options I have a question :- I have an asp.net page and i'm using TreeView control as links The links are on the left side of the page inside a iframe!...
6
by: paul | last post by:
HI! How do we send a variable from an Iframe page back to its parent? I have a script that calculates the iframe's window size but I need to know how to send that value back to its parent so I...
7
by: ukrbend | last post by:
I use an iframe on my home page and everything works perfectly. But now I decided to add a popups to my page. The popups come not from within the iframe but from the parent frame. Again, everything...
21
by: javainfo | last post by:
How can i refresh IFRAME and load data through AJAX?
5
by: BerlinBrown | last post by:
Do you know if it is possible to wait for the iframe page to load and then manipulate the iframe DOM. E.g. mypage: <script> function myinit() { theiframe.location = "iframe_with_frames.html"...
0
by: mem | last post by:
Hello, I'm a novice at this and am trying to solve a problem reference IFrame. The following code is for a page I've created. It works well with two exceptions. The IFrame is an application hosted...
23
by: vunet | last post by:
It is recommended by some sources I found to create IFrames in IE using document.createElement('<iframe src="#">') instead of document.createElement('iframe'). Why and what browser versions to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.