the penguin
07-22-2010, 02:46 PM
Hello,
I'm using this script to toggle between div's from a drop down select action. Is there a way I can expand this script to allow me to toggle with other divs?
Script:
<script type='text/javascript'>
function toggleSubmit(obj){
count=0
while(document.getElementById("d"+count)){
document.getElementById("d"+count).style.display="none"
count++
}
document.getElementById("d"+obj.selectedIndex).style.display="block"
}
</script>
HTML:
<form>
<select onChange="toggleSubmit(this)">
<option>AAA</option>
<option>BBB</option>
</select>
</form>
<div id="d0" style="display:block">
AAA
</div>
<div id="d1" style="display:none">
BBB
</div>
I tried adding div's with id's of d2 and d3, but no luck...
Thank you for the help.
I'm using this script to toggle between div's from a drop down select action. Is there a way I can expand this script to allow me to toggle with other divs?
Script:
<script type='text/javascript'>
function toggleSubmit(obj){
count=0
while(document.getElementById("d"+count)){
document.getElementById("d"+count).style.display="none"
count++
}
document.getElementById("d"+obj.selectedIndex).style.display="block"
}
</script>
HTML:
<form>
<select onChange="toggleSubmit(this)">
<option>AAA</option>
<option>BBB</option>
</select>
</form>
<div id="d0" style="display:block">
AAA
</div>
<div id="d1" style="display:none">
BBB
</div>
I tried adding div's with id's of d2 and d3, but no luck...
Thank you for the help.