silvertje
Joined: 24 Sep 2006 Posts: 2 Location: belgium
|
Posted: Wed Jan 31, 2007 4:56 pm Post subject: value help |
|
|
I have a select box which has images for options (the name) and I want onchange to display the corresponding image, this doesn't work exactly the way I want, I get for ex: tribal1 is being showed on every option! that's not what's supposed to happen, how will every image being showed onchange
I think I need to change the value var but I have no idea how.
| Code: |
<html>
<head>
<title></title>
<script type="text/javascript">
<!--
function popup()
{
var value;
switch(value)
{
case("t2"):
window.open("tribal2.jpg","","statusbar=no,scrollbars=yes,menubar=no,height=300,width=300")
break;
case("t3"):
window.open("tribal3.jpg","","statusbar=no,scrollbars=yes,menubar=no,height=300,width=300")
break;
default:
window.open("tribal1.jpg","","statusbar=no,scrollbars=yes,menubar=no,height=300,width=300")
}
}
//-->
</script>
<style type="text/css">
<!--
img {visibility:hidden}
-->
</style>
</head>
<body>
<form>
<select onchange="popup()">
<option value="t1">Tribal 1</option>
<option value="t2">Tribal 2</option>
<option value="t3">Tribal 3</option>
</select>
</form>
<br />
<br />
<br />
<!-- hier komen de prentjes -->
<img src="tribal1.jpg" />
<img src="tribal2.jpg" />
<img src="tribal3.jpg" />
<!-- einde prentjes -->
</body>
</html>
|
|
|