?
Solved

Enter key not firing in Firefox

Posted on 2006-05-16
8
Medium Priority
?
547 Views
Last Modified: 2012-05-05
Hi.

I have a textbox that I am trying to get to fire (run some javascript code) in Firefox. The code works just fine in IE, but it doesn't in ie.

This is where I stand right now.

Here how I defined my text box

<input type="text" runat="server" id="tbSearch" onblur="javascript:SearchEnter();" onkeydown="javascript:SearchEnter();">

The onblur and onkeydown will not fire the javascript. I have an alert box in the js and it never displays.  If I click on an image control (that has java attached) that will fire, but not the Enter key.

My java code looks like this:

function SearchEnter()
{

  if ( (window.event && window.event.keyCode == 13) || (window.event.charCode == 13))
  {
      alert("SearchEnter");
    SubmitSearch();
  }
}


Any help with this would be greatly appreciated.
0
Comment
Question by:WaldaInc
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 16696012
take a look here for a solution and why it doesnt work in ff
http://www.webmaster-talk.com/javascript-forum/40661-javascript-works-ie-but-not-firefox.html

good luck
0
 

Author Comment

by:WaldaInc
ID: 16696373
Nope.

That still wouldn't fire my function.  

Any other ideas??
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 16696647
I just spent sometime reading on fire fox handling of event since I know window.event is IE specific
I found something the author claims it worked for him.
It is a fairly long script.
http://groups.google.ca/group/comp.lang.javascript/browse_thread/thread/f5cb196ed8e299fc/5b3e8bd80dc55eaf?lnk=st&q=capture+enter+key+in+firefox&rnum=1&hl=en#5b3e8bd80dc55eaf

Good luck
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 20

Expert Comment

by:REA_ANDREW
ID: 16697456
All you need to do is use the panel with a default button tag. That is intended for this purpose so example

<asp:panel defaultbutton="Button1" runat="server">
        <h3>Search Discount Beauty Shop Products</h3>
        <asp:Label ID="Label1" runat="server" Text="Search"></asp:Label>
        <asp:TextBox ID="TextBox1" CssClass="textbox" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Search" CssClass="submitbutton" OnClick="SubmitSearch"/>
</asp:panel>
0
 
LVL 20

Expert Comment

by:REA_ANDREW
ID: 16790079
Hi,

Do you require further assistance with this?

Andrew
0
 

Author Comment

by:WaldaInc
ID: 16790160
Sorry for not responding sooner, I've been swamped at work.

This is the URL where I found the answer.  

http://www.webmaster-talk.com/javascript-forum/51214-enter-key-not-firing-in-firefox.html#post242639

Thanks for everyone's help on this issue.

yd
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16977841
PAQed with points refunded (125)

GranMod
Community Support Moderator
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question