Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #31 (permalink)  
Old March 17th, 2004, 10:57 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

twinkle,

try replacing right.src with document.getElementById('right').src

HTH,

----------
---Snib---
----------

<><
Reply With Quote
  #32 (permalink)  
Old March 17th, 2004, 11:04 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Snib,

I am afraid that won't work.

The right frame doesn't live in the same page. Both Left and Right are loaded in separate frames. To reach the frame, you'll need to access it through its parent property.

On Page 1 of this thread, I showed Twinkle how to do this (parent.leftFrame.document.getElementById('imgTest ').src) and suggested the alternative to set the source for the iframe directly (parent.leftFrame.src)

However, it looks like Twinkle is after something else.

Twinkle: want to give us a status update about what you have so far, and where you want to go?

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #33 (permalink)  
Old March 17th, 2004, 11:42 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Code:
index.html

<iframe src=left.html /><iframe id=right src=right.html />

left.html

<img src=imageone.png onclick="parent.document.getElementById('right').src=this.src">
<img src=imagetwo.png onclick="parent.document.getElementById('right').src=this.src">

right.html doesn't need anything in it.
Would this work?

I would try it on my own, but my server is being upgraded so I can't use it right now...

----------
---Snib---
----------

<><
Reply With Quote
  #34 (permalink)  
Old March 17th, 2004, 12:02 PM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Yes, that would definitely work.

However, right from the beginning, these kind of solutions have been offered. I tried to explain the general idea, without too much of an example, Joe posted a working example, you threw some useful stuff in the mix, but apparently, it's not what Twinkle is after.

I think what's he/she is after is a more advanced example. What we are offering here, is just a simple "find and replace": Find the target's source, and replace it with another image.
What is really needed is some more advanced stuff using z-indices, positioning and other JavaScript tricks to "dress the doll".

The Madonna link (or the Hanson link, if you can stand them) provides some more background information, but I am not sure whether that was enough or not.


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #35 (permalink)  
Old March 31st, 2004, 06:06 AM
Friend of Wrox
 
Join Date: Mar 2004
Location: Bhopal, MP, India.
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul
Default

Quote:
quote:Originally posted by twinkle
 Hi,
I need to know that: if u have a page with 2 iframes, one containes pictures and the other one is empty -
now if i want those pictures to appear in the empty iframe how to i do that?????

plz help!
1) First of all give name to your frames in FRAMESET.
   e.g, <FRAME name="./main" href="./main_page1.htm">
2) Just target other files to main frame from side frame.
   e.g., <A href="./main_page2.htm" target="./main"><IMG tag here></A>

That's all ..keep going!


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Frames Simmy73 ASP.NET 2.0 Basics 1 May 26th, 2006 07:26 AM
Frames ricardo_s HTML Code Clinic 1 April 27th, 2006 02:37 PM
FRAMES twinkle Javascript 2 March 30th, 2004 02:04 AM
i frames and all that Adam H-W HTML Code Clinic 2 November 5th, 2003 12:24 PM



All times are GMT -4. The time now is 12:10 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.