Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > stop [ENTER] from sending the form in NN/Firefox

Reply
Thread Tools

stop [ENTER] from sending the form in NN/Firefox

 
 
Perttu Pulkkinen
Guest
Posts: n/a
 
      12-02-2004
I use hit two function to stop [ENTER] from sending the form. First one I
use to move focus to the next desired field, second one to do nothing (when
there is no desired field to go).

Works in IE & Opera. How can I make these Netscape/Firefox-compatible (while
still keep them working in IE/Opera)?

function moveto(goal)
{
if(window.event && window.event.keyCode == 13)
document.getElementById(goal).focus();
return !(window.event && window.event.keyCode == 13);
}

function noenter()
{
return !(window.event && window.event.keyCode == 13);
}

--
Perttu Pulkkinen
www.risteys.net
www.onnenliinat.com
www.palvelukaupunki.fi


 
Reply With Quote
 
 
 
 
Daniel Kirsch
Guest
Posts: n/a
 
      12-02-2004
Perttu Pulkkinen wrote:
> I use hit two function to stop [ENTER] from sending the form. First one I
> use to move focus to the next desired field, second one to do nothing (when
> there is no desired field to go).
>
> Works in IE & Opera. How can I make these Netscape/Firefox-compatible (while
> still keep them working in IE/Opera)?
>
> function moveto(goal)
> {
> if(window.event && window.event.keyCode == 13)
> document.getElementById(goal).focus();
> return !(window.event && window.event.keyCode == 13);
> }
>
> function noenter()
> {
> return !(window.event && window.event.keyCode == 13);
> }
>


You need to pass the event object to your functions. window.event is a
MS implementation. The event object will be passed as first argument to
your event listener.

Daniel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pop-up form sending data to the calling form? Bjorn Sagbakken ASP .Net 4 06-30-2007 03:47 PM
Problem Sending email form web form =?Utf-8?B?SnVzdGlu?= ASP .Net 3 02-21-2005 01:39 PM
How to stop java service with command line parameter '-stop'? Will Java 1 11-02-2004 03:32 PM
How to stop a thread without using stop() Son KwonNam Java 11 04-09-2004 08:01 PM
Stop Debugging doesn't stop in ASP.NET Matt Theule ASP .Net 7 07-24-2003 07:38 PM



Advertisments