Advertisement

03.18.2008 at 04:50PM PDT, ID: 23252205
[x]
Attachment Details

Show / Hide <div> or <tr> on radio button click not working?

Asked by pdheady in Web Languages/Standards, JavaScript

Tags: javascript, javascript, javascript

I have two radio buttons. One is set to checked on page loading. The other set to hidden.

When checking back and forth it should show one <div> and hide the other, and vice versa.

Can't get it to work. The behavior is such that both <div> areas are displaying on page, and clicking back and forth does nothing.

Here is my code:Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
<script>
<!--
function show(street)
{
	          document.getElementById(box).style.display == 'none';
            document.getElementById(street).style.display = 'block';
            document.getElementById(street).style.visibility = 'visible';
 
}
//-->
 
<!--
function show(box)
{
	          document.getElementById(street).style.display == 'none';
            document.getElementById(box).style.display = 'block';
            document.getElementById(box).style.visibility = 'visible';
}
//-->
</script>
 
<div style="float: left"><input type=radio name="address_type" value="1" checked onClick="show('street');"></div>
<div style="float: left">Physical Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>-OR-</b>&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div style="float: left"><input type=radio name="address_type" value="2" onClick="show('box');"></div>
<div style="float: left">Postal Box</div>
 
 
<div id="street">
<tr><td>The Street Address fields here/td></tr>
</div>
 
<div id="box" style="display: none">
<tr><td>The Postal Box fields here</td></tr>
</div>
[+][-]03.18.2008 at 05:04PM PDT, ID: 21157388

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:05PM PDT, ID: 21157392

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:05PM PDT, ID: 21157395

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:10PM PDT, ID: 21157421

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:10PM PDT, ID: 21157423

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:17PM PDT, ID: 21157448

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:22PM PDT, ID: 21157481

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:25PM PDT, ID: 21157503

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Web Languages/Standards, JavaScript
Tags: javascript, javascript, javascript
Sign Up Now!
Solution Provided By: karlwilbur
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.18.2008 at 05:27PM PDT, ID: 21157514

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:35PM PDT, ID: 21157546

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:38PM PDT, ID: 21157560

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:41PM PDT, ID: 21157583

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:44PM PDT, ID: 21157597

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 06:02PM PDT, ID: 21157678

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628