Hi Graham,
I don't know if this solves your problem, but your way of accessing the
images seems a bit problematic.
Try this:
For IE 5+:
<img id=3D"pic1" src"...">
top.frames['main'].document.getElementById("pic1").src =3D
path+"vehicles/"+code+"1thumb.jpg";
top.frames['main'].document.getElementById("pic1").setAttribute("alt",
path+"vehicles/"+code+"1thumb.jpg - click to enlarge");
For IE 4 (if necessary):
<img id=3D"pic1" src"...">
top.frames['main'].document.all["pic1"].src =3D
path+"vehicles/"+code+"1thumb.jpg";
top.frames['main'].document.all["pic1"].setAttribute("alt",
path+"vehicles/"+code+"1thumb.jpg - click to enlarge");
/Robert
-----Ursprungligt meddelande-----
Fr=E5n: gbrown@c... [mailto:gbrown@c...]
Skickat: den 10 december 2002 13:58
Till: javascript
=C4mne: [javascript] Question about dynamically changing images in JS
Hi
What I have is page that basically contains this.
img height=3D1 src=3D# name=3Dpic1 onload=3D width=3D1 onclick=3D
In the page onload event I call this.
function showvehiclepicture(filename){=09
code=3Ddocument.form2.vehicle_id2.value
path=3Dtop.frames[0].document.variables.home.value
if(document.form2.pic1){
alert(path+"vehicles/"+code+"1thumb.jpg")
top.frames['main'].document.forms
[0].pic1.onLoad=3D"this.className=3D'picturebutton'"
top.frames['main'].document.forms[0].pic1.onClick=3D"window.open
('showpic.asp?filename=3D"+path+"vehicles/'+code+'1.jpg')"
top.frames['main'].document.forms
[0].pic1.src=3Dpath+"vehicles/"+code+"1thumb.jpg"
top.frames['main'].document.forms
[0].pic1.alt=3Dpath+"vehicles/"+code+"1thumb.jpg - click to enlarge"}
}
The JS is definitely being run because the alert appears, the picture
does
not appear though. If I change the size in the IMG tag to 100 then I get
the image.
I am fairly sure this code has worked before so I don't know whether it
is
a browser issue. We only use IE so it could be from 5 to 6.
Appreciate any pointers
Regards
Graham