...

View Full Version : Drop Down Images with Hyperlink Question



theflyingminstr
03-19-2009, 07:46 PM
Hi I was wondering if someone had a minute to show me how I might be able to match up changing hyperlinks to the below drop-down images selection script.

Thanks so much.



<html>
<head>

<script>

var Path='images/';

function CngColor(obj){
index=obj.selectedIndex;
if (index<1){document.getElementById('Img1').src="images/Blank.gif"; return; }
document.getElementById('Img1').src=Path+obj.options[index].id;
}

</script>

</head>

<body>

<select onchange="CngColor(this);" >
<option >Select</option>
<option id="image1.jpg" value="Image 1" >Image 1</option>
<option id="image2.jpg" value="Image 2" >Image 2</option>
<option id="image3.jpg" value="Image 3" >Image 3</option>
</select>

<a href="#">
<img id="Img1" src="images/Blank.gif" width=100 height=100 >
</a>

<script type="text/javascript">
window.onload=
function() {
var sels = document.getElementsByTagName('select');
CngColor(sels[0]);
CngColor2(sels[1]);
CngColor3(sels[2]);
};
</script>

</body>

</html>

Old Pedant
03-20-2009, 12:01 AM
Man, is that code overly complicated!

Anyway...

Is this really the same as your other question about "My Uncle" et al.???

If so:


<select
onchange="if ( this.selectedIndex!=0 ) window.open(this.options[this.selectedIndes].value,'POPUP','width=200,height=400);">
<option >Select</option>
<option value="image1.jpg">Image 1</option>
<option value="image2.jpg">Image 2</option>
<option value="image3.jpg">Image 3</option>
</select>

theflyingminstr
03-20-2009, 03:54 PM
yeah it was hanks again OP!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum