Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

ASP.NET defaultbutton not working in Chrome and Firefox

Avatar of David C
David CFlag for United Kingdom of Great Britain and Northern Ireland asked on
ASP.NET
8 Comments1 Solution3190 ViewsLast Modified:
Hi Experts, I have the code as below. I had been using this, since asp:panels were not working so I tried this and still cant get it to work. Can anybody point me in the right direction.
'function in root
function FireDefaultButton(event, target) {
    // srcElement is for IE
    var element = event.target || event.srcElement;

    if (13 == event.keyCode && !(element && "textarea" == element.tagName.toLowerCase())) {
        var defaultButton;
        defaultButton = document.getElementById(target);

        if (defaultButton && "undefined" != typeof defaultButton.click) {
            defaultButton.click();
            event.cancelBubble = true;
            if (event.stopPropagation)
                event.stopPropagation();
            return false;
        }
    }
    return true;
}


'.aspx.vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
   ClientScript.RegisterClientScriptInclude("FixFireDefault", "FireDefaultButtonFix.js")
End Sub


'.aspx
<div onkeypress="return FireDefaultButton(event, '<%= LinkButton1.ClientID %>')">
table with controls
</div>
ASKER CERTIFIED SOLUTION
Avatar of David C
David CFlag of United Kingdom of Great Britain and Northern Ireland imageIT Projects Manager

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answers