Jump to content

Recommended Posts

This a JavaScript question regarding cross frame scripting: How do I target a div, in this case <div id=‘PF_Text_Panel’>’, in an iframe using and onclick event in the parent document. I have a document, the parent page, containing 1 iframe. The parent page also contains some general information and the navigation links. The links refer to unique .html files, child pages, which are slideshows of jpeg images of different architecture projects of mine. Clicking on a project navigation links loads a slideshow in the iframe. Within the child page, the slideshow is its own <div>. The child page also contains a text panel describing the project. The text is in <div id=‘PF_Text_Panel’>. The text panel can be slid out of the way. Sliding is controlled by an onclick event which fires a javascript Spry slide effect that has the <div id=‘PF_Text_Panel’> as its target. The function which contains the slide effect is Slide_1T(). This function works fine when the event handler is in the same frame as <div id=‘PF_Text_Panel’>. http://dg-ad.com is set up that way now but I would like to change it. The following is a snippet of how I would image the parent page onclick event handler to look like but with some additional code in the Slide_1T() portion: <div><a href="#" onclick="setSldPnlState_2(); Slide_1T('PF_Text_Panel');">(TOGGLE TEXT PANEL)</a></div>

Share this post


Link to post
Share on other sites

script to target iframe content container through parent

function show_frame_content() {var F = document.getElementById('my_iframe'); //id of iframevar browser_specific = F.contentDocument || F.contentWindow.document; // use specific method depending if IE or not            var content = browser_specific.getElementById('hello').innerHTML; //id of iframe content to target            alert(content)}            window.onload=function(){show_frame_content()}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...