View Full Version : another hide/show div problem

05-10-2006, 02:38 AM
I thought I had my problem solved now my manager wants one item to show while the other hides. In a nutshell I have 2 divs that have radio buttons to show them. when one is clicked the other should hide but I've got it all screwed up. Here is the code I'm working with so far.
Thanks in advance
<script type="text/javascript">
<!-- Begin

var subs_array = new Array("sub1","sub2");// Put the id's of your hidden divs in this array

function displaySubs(the_sub){

if (document.getElementById(the_sub).style.display==""){

document.getElementById(the_sub).style.display = "none";return


for (i=0;i<subs_array.length;i++){

var my_sub = document.getElementById(subs_array[i]);

my_sub.style.display = "none";


document.getElementById(the_sub).style.display = "";


// End -->

<TABLE cellSpacing="1" cellPadding="1" bordercolor="#ff00ff" border="0">
<TD class="Normal" width="160">&nbsp;&nbsp;&nbsp;<input type="Radio" onclick="displaySubs('sub1')">Show Selected Accounts</TD>
<TD class="Normal" width="130"><input type="Radio" onclick="displaySubs('sub2')">Show All Accounts</TD>
<div id="sub1" style="display:none" class="tag"> blah blah blah</div>
<div id="sub2" style="display:none" class="tag"> blah blah blah2</div>

05-10-2006, 03:54 AM
function hide_other(but){
for(var a=0;a<sub_array.length;a++){

function displaySubs(the_sub){

05-11-2006, 03:09 AM
thank you so much it worked like a charm!!!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum