Click to See Complete Forum and Search --> : image references
russ801
03-11-2003, 06:55 PM
Do images have to refeneced directly or can they be referenced indirectly.
Trying to set up a thumbnail viewer. I want to build an array with all the images in them and then reference that array when displaying the images.
ie can an image be called like this?
var var1=images[0]
<img name=i1 src=var1.jpg>
khalidali63
03-11-2003, 07:25 PM
yes,it can be
:-)
Cheers
Khalid
russ801
03-11-2003, 07:36 PM
here is a snippet that I think should work if that is true.
<SCRIPT language="JavaScript1.2">
var photos = new Array(
new Array("Images/MarH0022V.jpg", "Images/MarH0022T.jpg","Images/MarH0022C.jpg"),
new Array("Images/NicM0421V","Images/NicM0421T",null),
new Array("Message-3W.jpg", null,null),
new Array("Message-1W.jpg","Message-3W.jpg",null)
);
//var bigimg= new Image()
var bigimg=photos[1][0]
alert (bigimg)
</SCRIPT></HEAD>
<BODY bgcolor="#474747">
<TABLE width="478" border="1" cellspacing="0" cellpadding="0" cool gridx="16" gridy="16" height="343" showgridx showgridy usegridx usegridy>
<TBODY>
<TR height="32">
<TD height="342" rowspan="4" width="268"><IMG name=bigimg src="bigimg.jpg"></TD>
</TR>
...
russ801
03-11-2003, 07:44 PM
What happens when you leave the SRC out and just use the name? I saw an example using this.
<SCRIPT language="JavaScript1.2">
var photos = new Array(
new Array("Images/MarH0022V.jpg", "Images/MarH0022T.jpg","Images/MarH0022C.jpg"),
new Array("Images/NicM0421V","Images/NicM0421T",null),
new Array("Message-3W.jpg", null,null),
new Array("Message-1W.jpg","Message-3W.jpg",null)
);
var bigimg= new Image()
bigimg.src=photos[1]
</SCRIPT></HEAD>
<BODY bgcolor="#474747">
<TABLE width="478" border="1" cellspacing="0" cellpadding="0" cool gridx="16" gridy="16" height="343" showgridx showgridy usegridx usegridy>
<TBODY>
<TR height="32">
<TD height="342" rowspan="4" width="268"><IMG name=bigimg src=""></TD>
...