Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-06-2012, 02:33 PM   PM User | #1
df_glazer
New to the CF scene

 
Join Date: Jan 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
df_glazer is an unknown quantity at this point
Cross Frame Scripting of Onclick Event Handler

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:

Code:
<div>
<a href="#" onclick=" Slide_1T(parent.frame[0].getElementbyId(‘PF_Text_Panel’);">(TOGGLE TEXT PANEL)</a>
</div>
df_glazer is offline   Reply With Quote
Old 03-06-2012, 07:21 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,468
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Thet code should work provided both web pages are on the same domain.

To communicate bwtween pages on different domains you need to use postMessage calls from JavaScript attached to both pages in order to pass messages between them.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Reply

Bookmarks

Tags
cross frame scripting

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:44 PM.


Advertisement
Log in to turn off these ads.