List Info

Thread: Re: getelementbyid across frames?




Re: getelementbyid across frames?
user name
2008-05-12 12:35:44

Say you have a frameset defined like this:

<frameset>
<frame src='somepage1.html' id='frame1' name='frame1'>
<frame src='somepage2.html' id='frame2' name='frame2'>
</frameset>

Then, lets say from 'frame1' you could do something like:

window.top.panel2.document.getElementById('testing').innerHTML='potato';

Hope this helps.

On a side note, you should probably try to re implement your page using DIV elements instead of Frames, as they are being deprecated on the HTML 5 specification.

Best Regards

Alligator_666

caitlin_weaver < no_reply%40yahoogroups.com">no_replyyahoogroups.com> wrote:
Say on frame 'one' I have this:

<a id='testing'>chips</a><br>

On the same page something like this works fine:

<a
onclick=&quot;document.getElementById('testing').innerHTML='potato';&quot;>click
here</a>

But I need to send something from frame 'two' and from there this does
not work:

<a
onclick=&quot;document.parent.frames['one'].getElementById('testing').innerHTML='potato';&quot;>click
here</a>

What am I doing wrong?

The reason I have two frames is that one is refreshing frequently to
fetch new data from a remote site. The idea is for javascript to
update the contents of the other frame without reloading the page.

Thanks a lot,
- Cait





---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )