[ List Archives Home ] [ Thread index for 2008 ] [ Date index for 2008 ] [ Author index for 2008 ]


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Here's a piece of JavaScript that we picked up along the way (no claim 
of authorship).  We use it on our searchX page to allow Netscape 4 and 
IE 4 users to hit enter to submit their search.  It's in action at:  
http://jacob.nlc.gwu.edu/search/X

<SCRIPT LANGUAGE="JavaScript1.2">

// Activates <enter> as submit
IE4 = (document.all);
NS4 = (document.layers);

if (NS4) document.captureEvents(Event.KEYPRESS);
document.onkeypress = doKey;

function doKey(e) {
whichASC = (NS4) ? e.which : event.keyCode;
if (whichASC == 13 || whichASC == 3) {
document.forms[0].submit()}
}
</SCRIPT>


Hope this helps,
Chris

Christopher C. Reed
Electronic Resources Librarian
Jacob Burns Law Library
The George Washington University Law School
716 20th Street, N.W.
Washington, D.C. 20052
(202) 994-1383
(202) 994-2874 (fax)
creed@xxxxxxxxxx



Date sent:      	Mon, 24 Jul 2000 09:14:03 -0400
From:           	Peter Murray <PMurray@xxxxxxxxxx>
To:             	innopac@xxxxxxxxxx
Subject:        	Re: AVS and Netscape
Send reply to:  	innopac@xxxxxxxxxx

> --On Saturday, July 22, 2000 1:18 PM -0600 Kim Crowley 
> <crowley@xxxxxxxxxx> wrote:
> > We have loaded advanced searching and are using the searchX option which
> > gives you all the limits up front.  When I use the AVS in Internet
> > Explorer, I can type in "cats and dogs" and hit return (without having
> > to click on the search button) to send my search.  When I use Netscape I
> > either have to click on the search button or tab through all the fields
> > and then hit return when I get to the search button.
> >
> > Since we use Netscape exclusively for our public access computers, I
> > would like to have Netscape work the way IE does (but only for this one
> > little thing).  Can anyone shed some light on this?
> 
> The short answer is, "That's the way it is."
> 
> The longer answer is that Explorer and Navigator handle the return key
> differently when used with forms.  Explorer will always use the return key
> to submit the form (unless the cursor is in a <TEXTAREA> field). 
> Navigator will use the return key to submit the form _only_ if there is
> one <INPUT TYPE="text"> field or the focus is on the submit button of the
> form.
> 
> Since the srchhelp_X.html page has more than one text field, Explorer will
> submit the search with the return character whereas Navigator will not.
> You'll see the same behavior with the combined author/title search form.
> 
> You can't configure Navigator to behave differently, and I'm not aware of
> any JavaScript tricks to do what you want, but perhaps someone more
> familiar with JavaScript has found a solution...
> 
> 
> Peter
> --
> Peter Murray, Computer Services Librarian              W: 860-570-5233
> University of Connecticut Law School             Hartford, Connecticut
> 
> -
> This message was distributed through the Innovative Users Group INNOPAC
> list. Private replies:  Peter Murray <PMurray@xxxxxxxxxx> Public
> replies:   INNOPAC@xxxxxxxxxx Archives: 
> http://innopacusers.org/list/archives/


--
This message was distributed through the Innovative Users Group INNOPAC list.
Private replies:  "Chris Reed" <creed@xxxxxxxxxx>
Public replies:   INNOPAC@xxxxxxxxxx
Archives:  http://innopacusers.org/list/archives/