By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,274 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

change img.src in different frame

P: 2
hi everyone! i'm working on a little portfolio site and would now really appreciate some help, since i'm stuck. the thing is i got thumbnails in one frame, and would like to, as you click on a thumbnail, change the img src in another frame.

i tried to make it somehting like this, which didn't work..

frame 1:

<img src="thumbnail1.jpg" onclick="top.frame2.photoview.src=''photo1.jpg;">

frame 2 (named "frame2"):

<img src="photo.jpg" id="photoview">

probably it's just some simple error somewhere, i ain't all that gifted in javascript, but anyways, someone help me? please?
Oct 9 '07 #1
Share this Question
Share on Google+
3 Replies


dmjpro
100+
P: 2,476
hi everyone! i'm working on a little portfolio site and would now really appreciate some help, since i'm stuck. the thing is i got thumbnails in one frame, and would like to, as you click on a thumbnail, change the img src in another frame.

i tried to make it somehting like this, which didn't work..

frame 1:

<img src="thumbnail1.jpg" onclick="top.frame2.photoview.src=''photo1.jpg;">

frame 2 (named "frame2"):

<img src="photo.jpg" id="photoview">

probably it's just some simple error somewhere, i ain't all that gifted in javascript, but anyways, someone help me? please?
Have a careful look............

Expand|Select|Wrap|Line Numbers
  1. <img src="thumbnail1.jpg" onclick="top.document.frames["frame2"].document.getElementById("photoview").src='photo1.jpg;'">
  2.  
Debasis Jana
Oct 9 '07 #2

P: 2
Have a careful look............

Expand|Select|Wrap|Line Numbers
  1. <img src="thumbnail1.jpg" onclick="top.document.frames["frame2"].document.getElementById("photoview").src='photo1.jpg;'">
  2.  
Debasis Jana
thanks a lot! worked in ie, but not in firefox?

EDIT: the ff error console says "top.document.frames has no properties"
Oct 9 '07 #3

dmjpro
100+
P: 2,476
thanks a lot! worked in ie, but not in firefox?

EDIT: the ff error console says "top.document.frames has no properties"
I think this is "Standard" code for all browsers.
So wait for the Experts like "Gits" or "Acoder" ..... let them see your problem.
Have a good day !

Debasis Jana
Oct 10 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.