radio button visible=true using javascript

Currently I have this tag:

<asp:CheckBox runat="server" Visible="false" ID="domain1nego" Text="I would like to consider negotiations with current owner." />


What javascript code would I need in order to make domain1nego.Visible="True"


I tried using:

<script language="javascript" type="text/javascript">
    function showDomainNego1() {
        document.getElementById('domain1nego').style.visibility = 'visible';
        return false;
    }
</script>

but it didn't work.


Thanks ahead of time!!
igotstehsolutionAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
Try :
<script language="javascript" type="text/javascript">
    function showDomainNego1() {
        document.getElementById('domain1nego').style.visibility = true;
        return false;
    }
</script>

Open in new window

0
leakim971PluritechnicianCommented:
This one too :


<script language="javascript" type="text/javascript">
    function showDomainNego1() {
        document.getElementById('<%= domain1nego.ClientID %>').style.visibility = true;
        return false;
    }
</script>

Open in new window

0
igotstehsolutionAuthor Commented:
I tried both. Unfortunately neither worked.

Any other suggestions?
0
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

leakim971PluritechnicianCommented:
Use :



because Visible="false" is interpreted on the server side and the checkbox is not in the page at the loading so you can't play with Javascript.

To display it, use : document.getElementById('domain1nego').setAttribute("display", "block");
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication13._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:CheckBox runat="server" display="hidden" ID="domain1nego" Text="I would like to consider negotiations with current owner." />
    <script language="javascript" type="text/javascript">
        document.getElementById('domain1nego').setAttribute("display", "block");
    </script>
    </form>
</body>
</html>

Open in new window

0
igotstehsolutionAuthor Commented:
<asp:CheckBox runat="server" display="hidden" ID="domain1nego" Text="I would like to consider negotiations with current owner." />

is still visible. so I tried style="display:none" and that made it invisible yet your setattribute script didn't work.


I tried making getElementById('<%= domain1nego.ClientID %>') aswell but that also didn't work.
0
leakim971PluritechnicianCommented:
Sorry : display="none"
0
leakim971PluritechnicianCommented:
not : display="hidden"
0
igotstehsolutionAuthor Commented:
display="none" still doesn't work. the checkbox is visible.
0
leakim971PluritechnicianCommented:
sorry again the right one is: style="display:none"
<asp:CheckBox runat="server" style="display:none" ID="domain1nego" Text="I would like to consider negotiations with current owner." />

Open in new window

0
leakim971PluritechnicianCommented:
and :


document.getElementById('domain1nego').setAttribute("style", "display:block");

Open in new window

0
igotstehsolutionAuthor Commented:
Now its hidden but javascript isn't working to make it visible again.
0
leakim971PluritechnicianCommented:
Try this :

document.getElementById('domain1nego').parentNode.setAttribute("style", "display:block");
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication13._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>

</head>
<body>
    <form id="form1" runat="server">
    <asp:CheckBox runat="server" style="display:none" ID="domain1nego" Text="I would like to consider negotiations with current owner." />
    <script language="javascript" type="text/javascript">
        document.getElementById('domain1nego').parentNode.setAttribute("style", "display:block");
    </script>
    </form>
</body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
igotstehsolutionAuthor Commented:
works :)

tytyty
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.