...

View Full Version : select menu on click div appears



Baleric
10-27-2006, 03:17 AM
hey people,
doesn anyone know a javascript code to make div tags appear and disapear on click i have 3 items in a select menu, and when i click each one i would like to have some text change on the page, ive googled it for about an hour and couldnt find the right thing i am looking for.

any help greatly appreciatiated

Mr J
10-27-2006, 02:14 PM
Give this a try


<script type="text/javascript">

myText=[
"Hello World",
"Some Dummy Text",
"And a bit more for luck" // no comma at the end of last index
]

function showText(n){
document.getElementById("display").innerHTML=myText[n]
}

</script>

<div id="display"></div>

<select id="s1" onchange="showText(this.selectedIndex)">
<option>1</option>
<option>2</option>
<option>3</option>
</select>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum