To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.admin.generalOpen lugnet.admin.general in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Administrative / General / 5299
5298  |  5300
Subject: 
Re: Search button
Newsgroups: 
lugnet.admin.general
Date: 
Fri, 17 Mar 2000 22:24:59 GMT
Viewed: 
794 times
  
In lugnet.admin.general, Mark Koesel writes:
I understand your frustration, but this isn't strictly true.  You can attach
a onkeypress event to the search boxes in IE4 and later (not easily doable
in NS4, since they are not DOM compliant yet), which and submit the form for
you.

Something like (and this is off the top of my head so it may need syntax
corrections):

<input type="text" onkeypress="this.form.submit();">

I'm not positive what effect (if any) this will have on Netscape Browsers.
You may need to execute it conditionally, depending on the browser type.

Actually, I was recently playing with this (using MSIE 5.0, NN 4.05) and I
think the results were the same in MSIE and NN:

onkeypress:
   - This performs the function when ANY character is entered, but STOPS the
     submit if further characters are entered (in other words, type quickly!).
     And finally, for extra frustration, it doesn't submit the last character
     entered (which is fine if the last character is a \n, but not so
     otherwise.)
onkeydown:
   - Same gosh darn thing as onkeypress! (Stupid? yes!)

What you might want is "onchange", but that has issues when more than 1 text
field is within the form... As I recall, "onchange" resulted in:

onchange w/ 1 text box:
   - MSIE: Form is submitted when enter is hit
   - NN: Form is submitted when enter is hit
onchange w/ 2 text boxes:
   - MSIE: Form is NOT submitted when enter is hit, but it IS submitted when
     focus is taken off the text box (Stupid? yes.)
   - NN: Form is submitted when enter is hit

Alternatively you could cheat and put ALL the entry fields into ONE form, then
use javascript to control what fields are input where (although that causes no
end of coding nightmares... You need to deal with all these javascript tags on
the entry fields, extra javascript functions, the 'onsubmit' tag, etc. It's a
lot of useless effort, but it CAN be made to work if you're a masochistic
coder!)

DaveE



Message has 2 Replies:
  Re: Search button
 
(...) Does that work even if the user has disabled JavaScript? --Todd (25 years ago, 17-Mar-00, to lugnet.admin.general)
  Re: Search button
 
"David Eaton" <deaton@intdata.com> wrote in message news:FrL7Ln.7vs@lugnet.com... (...) the (...) quickly!). (...) character (...) Yeah, they are basically the same. MSDN claims they are different, but they appear to function identically in IE5. As (...) (25 years ago, 17-Mar-00, to lugnet.admin.general)

Message is in Reply To:
  Re: Search button
 
"Todd Lehman" <lehman@javanet.com> wrote in message news:FrJ8B3.wu@lugnet.com... (...) containing (...) HTML (...) I understand your frustration, but this isn't strictly true. You can attach a onkeypress event to the search boxes in IE4 and later (...) (25 years ago, 17-Mar-00, to lugnet.admin.general)

131 Messages in This Thread:
(Inline display suppressed due to large size. Click Dots below to view.)
Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR