iframe

i have:

index.html-

<html>
..
..
..
<img src="one.jpg" name="picture">
..
..
<ifram src="frame.html"></iframe>
..
</html>



in my frame.html, i have
<img src="m.jpg" onClick="????">

in this case, i want the ???? to be : when i click on that image m.jpg, then "picture" 's source will change to m.jpg.
how do i do that?

I know that if its without iframe, then i can have ???? -> picture.src='m.jpg'. this doesnt seem to work with iframe tho..
any solution?

sutejokAsked:
Who is Participating?
 
COBOLdinosaurCommented:
Yeah I guess we need the reference to the document object in there:
 
<img src="m.jpg" onClick="parent.document.images['picture'].src=this.src">

Cd&
0
 
william007Commented:
In the index.html
<html>
<body>
<iframe src="frame.html"></iframe>
</body>
</html>

In Frame.html
<img src="Winter.jpg" onclick="javascript:this.src='sunset.jpg'"/>

I test it in index.html...it works well...Is it what u want?
0
 
COBOLdinosaurCommented:
<img src="m.jpg" onClick="parent.images['picture'].src=this.src">

Cd&
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
sutejokAuthor Commented:
william007  -  
in this case, i want the ???? to be : when i click on that image m.jpg, then "picture" 's source will change to m.jpg.
how do i do that?

"picture" is the name of the image from the main frame.. sorry for the unclear statement


Cd& -
the image in the parent frame doesnt change..

thx guys
0
 
sutejokAuthor Commented:
thx
0
 
COBOLdinosaurCommented:
Glad we could help.  Thanks for the A. :^)

Cd&
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.