Monday, October 29, 2012

Toggle Display (On / Off)

JavaScript
<script language="javascript" type="text/javascript">

  function TDisplay(elementID) {

  var CurrentElement = document.getElementById(elementID);

  CurrentElement.style.display = (CurrentElement.style.display != 'none') ? 'none' : '';

  return false;

}

</script>

.ASPX Page
<asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return TDisplay('panel1');">

Toggle Display(On / Off)</asp:LinkButton>

<asp:Panel ID="panel1" runat="server">

    Panel content here!

</asp:Panel>

No comments:

Post a Comment