I've been using server control button, and on its click event i m showing or hiding the div content on the basis of its current style.
ASP code for button is:
Expand|Select|Wrap|Line Numbers
- <asp:Button ID="btnClickMe" Text="Click Me...!" OnclientClick="HideDiv('PostNewTopic')" runat="Server" />
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript" language="javascript" >
- function HideDiv(id)
- {
- if (document.getElementById(id).style.display=="none"){
- document.getElementById(id).style.display='inline';
- }
- else{
- document.getElementById(id).style.display='none';
- }
- }
- </script>
What the problem i m facing is on clicking the button it is hiding and again showing the div content, because the page is getting refreshed
Event is getting fired two times, so the result is same i.e, div content is shown and cannot be hidden.
help would really be appreciated.
Thank you all.