this will no solve your original problem but
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
.selected {
border:solid red 1px;
}
/*]]>*/
</style><script type="text/javascript">
/*<![CDATA[*/
var Set1=[
'select print for set 1', // select option 0
// field 0 = the image src
// field 1 = the select option value
// field 2 = the select option text
['http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg','Set 1 Print 1 value','Set 1 Print 1'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg','Set 1 Print 2','Set 1 Print 2'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt7.jpg','Set 1 Print 3','Set 1 Print 3'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt8.jpg','Set 1 Print 4','Set 1 Print 4']
];
var Set2=[
'select print for set 2', // select option 0
// field 0 = the image src
// field 1 = the select option value
// field 2 = the select option text
['http://www.vicsjavascripts.org.uk/StdImages/1.gif','Set 2 Print 1 value','Set 2 Print 1'],
['http://www.vicsjavascripts.org.uk/StdImages/2.gif','Set 2 Print 2','Set 2 Print 2'],
['http://www.vicsjavascripts.org.uk/StdImages/3.gif','Set 2 Print 3','Set 2 Print 3'],
['http://www.vicsjavascripts.org.uk/StdImages/4.gif','Set 2 Print 4','Set 2 Print 4']
];
function SelectSet(id,ary,s){
var img=document.getElementById(id),s=document.getElementById(s),z0=0;
if (img&&ary instanceof Array&&s&&s.nodeName.toUpperCase()=='SELECT'){
if (SelectSet.img){
SelectSet.img.className=SelectSet.img.className.replace(' selected','');
}
SelectSet.img=img;
SelectSet.ary=ary;
img.className+=' selected';
s.options.length=1;
s.options[0].text=ary[0];
for (;z0<ary.length;z0++){
if (ary[z0]&&ary[z0][0]&&ary[z0][1]){
s.options[z0+1]=new Option(ary[z0][2]||ary[z0][1],ary[z0][1]);
}
}
}
}
function SelectPrint(s){
if (SelectSet.img&&SelectSet.ary&&SelectSet.ary[s.selectedIndex]){
SelectSet.img.src=SelectSet.ary[s.selectedIndex][0];
}
}
/*]]>*/
</script></head>
<body>
<img id="i1" src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" onclick="SelectSet('i1',Set1,'select')" alt="img" width="200" height="150" />
<img id="i2" src="http://www.vicsjavascripts.org.uk/StdImages/1.gif" onclick="SelectSet('i2',Set2,'select')" alt="img" width="200" height="150" />
<br />
<select id="select" onchange="SelectPrint(this);">
<option>Select An Image</option>
</select>
</body>
</html>
Bookmarks