Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Question about dynamically changing images in JS


Message #1 by gbrown@c... on Tue, 10 Dec 2002 13:58:24
Hi 

What I have is page that basically contains this.

img height=1 src=# name=pic1  onload= width=1 onclick=

In the page onload event I call this.

function showvehiclepicture(filename){	
code=document.form2.vehicle_id2.value
path=top.frames[0].document.variables.home.value
if(document.form2.pic1){
alert(path+"vehicles/"+code+"1thumb.jpg")

top.frames['main'].document.forms
[0].pic1.onLoad="this.className='picturebutton'"
	top.frames['main'].document.forms[0].pic1.onClick="window.open
('showpic.asp?filename="+path+"vehicles/'+code+'1.jpg')"
	top.frames['main'].document.forms
[0].pic1.src=path+"vehicles/"+code+"1thumb.jpg"
	top.frames['main'].document.forms
[0].pic1.alt=path+"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


  Return to Index