Click here to Skip to main content
15,908,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript

hi friends
i have create javascript function dive hide show and it work properly i click yes button div is show and when click no div is hide
and my problem is when page is lode dive automatic hide so give me some idea


thanks to advance


XML
<script>

  function reg_phd_unction(value) {
     if (value == "209") {
                     document.getElementById("ctl00_ContentPlaceHolder1_dv_reg_phd").style.display = "block";
    }
      else if (value == "210") 
    {
                        document.getElementById("ctl00_ContentPlaceHolder1_dv_reg_phd").style.display = quot;none";
     }

  }



VB
<asp:RadioButton onclick="reg_phd_unction(this.value)" GroupName="member5" ID="rd_phd_yes"
                       Text="Yes" Value="209" runat="server" />
                   <asp:RadioButton onclick="reg_phd_unction(this.value)" GroupName="member5" ID="rd_phd_no"
                       Text="No" Value="210" runat="server" />



<div id="dv_reg_phd" runat="server" style="display: none;">
Posted

dear you have set div style display to none remove it then try and tell me..........(:)
 
Share this answer
 
keep your div style display property status in hidden field and at the time of postback of page using u can use either window.onload method to assign values to ur div or , make your div runat server and assign respective value at code behind itself


best u use asp control panel so that you can control code behind also and by script also
 
Share this answer
 
v2
 u have use 
<div id="dv_reg_phd"  runat="server" style="display: none;">

but try this
<div id="dv_reg_phd"  runat="server"> 


</div></div>


Enjoy Coding...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900