Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Re: Firing onClick Event After Specified Number of Characters Have Pa ssed


Message #1 by "Nagamani" <nagamani.v@e...> on Fri, 22 Nov 2002 13:29:32
Do you mean after your user has scanned the code, he's supposed to press the
<Enter> key?  If yes, you could use the onchange handler.

> Hello everyone.  I have a decent amount of experience with 
> VBScript.  I'm
> just starting to get my feet wet with JavaScript.  I have a 
> problem and I
> suspect JavaScript provides the best answer.  I thought I'd 
> first seek the
> opinions of those more knowledgeable than I!
> 
> Here is the deal:
> 
> I'm writing a web application that will be used to look up 
> book pricing
> info.  One option will be to search by isbn.  The user should 
> be able to
> enter the isbn by hand or scan the isbn using a barcode 
> reader.  When the
> isbn is scanned, something like this is passed to the field 
> with focus:
> 
> ~9780123456789 (The actual isbn number in this case is 0-123456-78-9)
> 
> When a barcode is scanned, the application needs to fire the 
> onClick event
> for the form's submit button (Search.onClick)
> 
> My first thought is I should write a function that is called when the
> onKeyPress event is fired on the textbox in which the isbn is scanned
> (textbox.onKeyPress = "function")
> 
> The function will then determine if the first 4 characters in 
> the textbox
> are "~978".  If the answer is yes, the function should fire 
> the onClick
> event after 10 more characters have passed.
> 
> Any thoughts?
> 
> Many thanks in advance.
> 

  Return to Index