sagrav
08-08-2008, 12:26 PM
Hi there,
I am just getting started so this is a very basic problem.
Have managed to get most of the way to solving my problem with the help of some code on this past post:
http://www.dynamicdrive.com/forums/archive/index.php/t-17232.html
Basically, the last issue I need to solve is to make the three radio buttons exclusively selectable (only one may be selected at any one time).
This is the code I have:
=========================================================
<html>
<head>
<script type="text/javascript">
onload=function(){
document.getElementById('accept').checked=false;
}
</script>
</head>
<body>
<table border="1">
<tr>
<td width="100" height="25"><input type="radio" id="accept" onclick="this.ticked=this.ticked? 0 : 1;
document.getElementById('dropdown1').style.display =this.ticked? 'block' : 'none';this.checked=this.ticked;">Option 1</td>
<td width="100" height="25"><input type="radio" id="accept" onclick="this.ticked=this.ticked? 0 : 1;
document.getElementById('dropdown2').style.display =this.ticked? 'block' : 'none';this.checked=this.ticked;">Option 2</td>
<td width="100" height="25"><input type="radio" id="accept" onclick="this.ticked=this.ticked? 0 : 1;
document.getElementById('dropdown3').style.display =this.ticked? 'block' : 'none';this.checked=this.ticked;">Option 3</td>
</tr>
<tr>
<td width="300" height="25" colspan="3"><div id="dropdown1" style="display:none">Display Content 1</div><div id="dropdown2"
style="display:none">Display Content 2</div><div id="dropdown3" style="display:none">Display Content 3</div></td>
</tr>
</table>
</body>
</html>
=========================================================
Any help will be greatly appreciated.
Thanks!
I am just getting started so this is a very basic problem.
Have managed to get most of the way to solving my problem with the help of some code on this past post:
http://www.dynamicdrive.com/forums/archive/index.php/t-17232.html
Basically, the last issue I need to solve is to make the three radio buttons exclusively selectable (only one may be selected at any one time).
This is the code I have:
=========================================================
<html>
<head>
<script type="text/javascript">
onload=function(){
document.getElementById('accept').checked=false;
}
</script>
</head>
<body>
<table border="1">
<tr>
<td width="100" height="25"><input type="radio" id="accept" onclick="this.ticked=this.ticked? 0 : 1;
document.getElementById('dropdown1').style.display =this.ticked? 'block' : 'none';this.checked=this.ticked;">Option 1</td>
<td width="100" height="25"><input type="radio" id="accept" onclick="this.ticked=this.ticked? 0 : 1;
document.getElementById('dropdown2').style.display =this.ticked? 'block' : 'none';this.checked=this.ticked;">Option 2</td>
<td width="100" height="25"><input type="radio" id="accept" onclick="this.ticked=this.ticked? 0 : 1;
document.getElementById('dropdown3').style.display =this.ticked? 'block' : 'none';this.checked=this.ticked;">Option 3</td>
</tr>
<tr>
<td width="300" height="25" colspan="3"><div id="dropdown1" style="display:none">Display Content 1</div><div id="dropdown2"
style="display:none">Display Content 2</div><div id="dropdown3" style="display:none">Display Content 3</div></td>
</tr>
</table>
</body>
</html>
=========================================================
Any help will be greatly appreciated.
Thanks!