@edatzSep 17.2010 — #Here's something I use now and then. I didn't write it but you could use it as a base to work from. [CODE]<html> <head> <title>Click and show</title> <style type="text/css">body {font-family: Verdana;}</style> <script language="Javascript"> <!-- Begin // -- Contact verify function button_show ( ) { valid = true; if ( document.tlform.Name.value == "" ) {alert ( "Please click a radio button for the nature of your request." ); valid = false;} return valid;} var message=""; function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") function showdetails(el) { if (el.value == "Edit") {document.getElementById('text').style.display = "block";} else {document.getElementById('text').style.display = "none"; document.getElementById('eded').value = ''; } } // End --> </script> </head> <body> <div align="center"> <p>Radio Button Option Drop Down</p> <form name="tlform" action="#" method="post" onSubmit="return button_show ( );"> <small><b>Pick an option: </b> <br> Yes <input type="radio" name="request" value="Edit" onclick="showdetails(this);"> - No <input type="radio" name="request" value="Delete" onclick="showdetails(this);" checked></small><br>
<div id="text" style="display:none;" align=center><small>Some kind of text.</small><br> <input type="text" name="editdetails" class="iparea" id="eded" value=""> <br> The form element could be anything.<br> Just insert the code into a form. </div> </form> </div> </body></html>[/CODE]
@edatzSep 17.2010 — #Or, slightly different than JMRKER's in that you have one checked for a no show and you have to define the number of "shows" (divs). This one I used for something different [I](a set of instructions with about 12 divs and links instead of buttons.)[/I] You could have as many buttons as you want - even inside of a show div). [CODE]<html> <head> <title>RoundTable Manual</title> <style type="text/css"> body {font-family: Verdana;} .rslt {display:none; border:1px solid; width:200px;} </style> <script type="text/javascript"> function rd(id) { /// -- <=4 -- number match number of div results for (i=1;i<=4;i++) {
var divname = 'div'+i; var divStyle = document.getElementById(divname).style; divStyle.display=(id==divname)?'block':'none'; } } </script> </head> <body><div align="center"> <form> <b>Radio Show</b><br> No <input type="radio" name="show" onClick="rd('div1');" checked> One <input type="radio" name="show" onClick="rd('div2');"> Two <input type="radio" name="show" onClick="rd('div3');">
<div id="div4" class="rslt"><b>Three</b></div> </form> </body> </html>[/CODE] Note the "number match number of div results" and line under it. The number 4 would be changed ot as many divs as you are going to use.