You are going to need more than one option in the select to even have an onchange event. You might want to be showing and hiding more than one div as well.
I don't think:

Originally Posted by
mburt
Code:
[options.value.selectedIndex]
has any value, though it might. Did you test it?
Anyways, if you follow my idea of multiple divisions to show and hide with multiple options in the select, you could have something like so:
Code:
function show_hide(id, show){
if(show)
document.getElementById(id).style.display = "block";
else
document.getElementById(id).style.display = "none";
}
But, there seems to be no logical trigger for hiding the content later, after it has been revealed, if desired (this would depend upon personal preference of the designer). No allowance seems to have been made for non-javascript enabled browsers either. Here is a demo that works all of this out:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#container {
width:350px;
}
</style>
<script type="text/javascript">
var disStyle=0
var dom=document.getElementById||document.all
function getItem(id) {
return document.getElementById&&document.getElementById(id)? document.getElementById(id) : document.all&&document.all[id]? document.all[id] : null;
}
if(dom)
document.write('<style type="text/css" id="dummy">\
.tlink{\
display:none;\
}\
<\/style>')
if(dom&&typeof getItem('dummy').disabled=='boolean'){
document.write('<style type="text/css" id="showhide">\
.showhide{\
display:none;\
}\
#cdiv0 {\
display:block;\
}\
<\/style>');
disStyle=1;
}
function displayOne(idPrefix, idNum){
var i=0;
while (getItem(idPrefix+i)!==null){
getItem(idPrefix+i).style.display='none';
i++;
}
if (typeof idNum!=='undefined')
getItem(idPrefix+idNum).style.display='';
}
onload=function(){
displayOne('cdiv', 0);
if (disStyle)
getItem('showhide').disabled=true;
}
</script>
</head>
<body>
<select onchange="displayOne('cdiv', this.selectedIndex);">
<option>See text</option>
<option>See more text</option>
<option>See something</option>
<option>See hey</option>
</select>
<div id="container"><div class="showhide" id="cdiv0" name="cdiv0">Text Text Text Text Text Text Text Text Text Text Text <a class="tlink" href="#">[Top]</a><br> </div>
<div class="showhide" id="cdiv1" name="cdiv1">More Text More Text More Text More <a class="tlink" href="#">[Top]</a><br> </div>
<div class="showhide" id="cdiv2" name="cdiv2">Something Something Something Something Something Something Something <a class="tlink" href="#">[Top]</a><br> </div>
<div class="showhide" id="cdiv3" name="cdiv3">Hey! Hey! Hey! Hey! <a class="tlink" href="#">[Top]</a><br> </div></div>
</body>
</html>
But, as I say, the designer may have his/her own preferences.
Bookmarks