Forum Moderators: open
<html><head><title>whatever</title>
<script type="text/javascript">
var textBlocks = new array(
'Select from the list to change this box',
'Text block two',
'Text block three');
function changeText(form) {
var ind = form.whatever.selectedIndex;
form.display.value=textBlocks[ind];
}
</script>
</head><body>
<form>
<select name="whatever" onChange="changeText(this.form);">
<option value="0">Select</option>
<option value="1">One</option>
<option value="2">Two</option>
</select><br>
<textarea name="display">Select from the list to change this box</textarea>
</form>
</body></html>
Untested, but should work.
Bono is awesome, "can't sing but I got soul." :-)
(although symantically completely wrong probably)
Use a text field or a textarea as described, then use CSS to make the borders invisible, and onfocus=blur(); to make it non-editable. I've done this one before but you'll have to do your homework to get the CSS, it's not handy at the moment. :-)
<html><head><title>whatever</title><script type="text/javascript">
var textBlocks = new Array(
'Select from the list to change this box',
'Text block two',
'Text block three');function changeText(elemid) {
var ind = document.getElementById(elemid).selectedIndex;
document.getElementById("display").innerHTML=textBlocks[ind];
}
</script></head><body>
<form>
<select id="whatever" onChange="changeText('whatever');">
<option value="0">Select</option>
<option value="1">One</option>
<option value="2">Two</option>
</select><br>
</form>
<div id="display">Select from the list to change this box</div>
</body></html>
You can change the div to any other element, such as a span, if you wish.