By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,480 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,480 IT Pros & Developers. It's quick & easy.

getelementbyid and iframes

P: n/a
hi all i cant get getelementbyid working to access a div tag within an
iframe of my page. is this not possible? if it isnt what alternatives
do i have?

regards

marc

Sep 3 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

libsfan01 wrote:
hi all i cant get getelementbyid working to access a div tag within an
iframe of my page. is this not possible? if it isnt what alternatives
do i have?
That is not possible since the iframe is really an "another page".
Therefore you can do the following instead:

html 1:

<iframe name = "myframe" src = "html2.html"></iframe>

html 2:

<div id = "foo">etc</div>
To access the div element from html 1, you can do the following:

frames["myframe"].document.getElementById("foo");

Sep 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.