View Single Post
Old 01-29-2013, 04:00 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,032
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Is this what you are looking for?

Code:
<div id = "mydiv1" style="display:block">
<select id = sel1">
<option>First menu</option>
</select>
<input type = "button" id = but1" value = "Button 1" onclick = "toggle()">
</div>
<div id = "mydiv2" style="display:none">
<select id = sel2">
<option>Second menu</option>
</select>
<input type = "button" id = but2" value = "Button 2" onclick = "toggle()">
</div>

<script type = "text/javascript">
function toggle() {
var d1 = document.getElementById("mydiv1");
var d2 = document.getElementById("mydiv2");
if (d1.style.display == "block") {d1.style.display = "none"}
else {d1.style.display = "block"}
if (d2.style.display == "block") {d2.style.display = "none"}
else {d2.style.display = "block"}
}
</script>

The people who followed the Lord were called the 12 Decibels.
- Pupil's answer to Catholic Elementary School test.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote