troubleshooting Question

Why does javascript run twice

Avatar of mgmhicks
mgmhicks asked on
JavaScript.NET ProgrammingVisual Basic.NET
14 Comments1 Solution440 ViewsLast Modified:
I have a buttonlink with a onclientClick set to "HideSummary".

So a page loads up and I have this button link and when I click it, it runs the javascript, and then runs it again, leaving my form in the same condition.  Can someone tell my why its running it 2 times.  Here is part of the loaded form

                    <asp:LinkButton ID="lbSummary" runat="server"
                         onclick="HideSummary()">Hide Summary</asp:LinkButton>
              <table id="SummaryCharges" style="border-color: #507CD1; border-style: solid; width: 74%">
                        <td style="text-align: center; border-bottom-style: solid; border-color: #507CD1; backgroun

Here is the java script.

function HideSummary() {
        var frm_element = document.getElementById('ctl00_ContentPlaceHolder1_lbSummary');
        var frm_ElementTable = document.getElementById('SummaryCharges');
        var vis =;
        var visTable =;
        if (visTable.display == '' || visTable.display == 'none') {

            document.getElementById('SummaryCharges').style.display = 'block';


        else {

            document.getElementById('SummaryCharges').style.display = 'none';


Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 14 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros