Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0
This is the forum to discuss the Wrox book Professional JavaScript for Web Developers by Nicholas C. Zakas; ISBN: 9780764579080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 16th, 2006, 10:49 PM
din din is offline
Registered User
 
Join Date: Jan 2006
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default code in CH11 not work in FireFox

code: BlockPasteExample.htm;
      BlockPasteExample1.htm;
      BlockPasteExample2.htm
in IE, it work well, but in my FireFox(1.5), i cannot use the backspace.
it just block the backspace key.
is it a bug in FireFox? or in the code?


  #2 (permalink)  
Old January 16th, 2006, 11:29 PM
din din is offline
Registered User
 
Join Date: Jan 2006
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i change the code
Code:
 if (bBlockPaste) {
        return bIsValidChar && !(oEvent.ctrlKey && sChar == "v");
    } else {
        return bIsValidChar || oEvent.ctrlKey;
    }
to
Code:
   if (bBlockPaste) {
        return (bIsValidChar|| oEvent.shiftKey|| oEvent.keyCode==8) && !(oEvent.ctrlKey && sChar == "v");
    } else {
        return bIsValidChar || oEvent.ctrlKey || oEvent.shiftKey || oEvent.keyCode==8;
    }
then the FireFox works.


  #3 (permalink)  
Old January 18th, 2006, 09:21 PM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

It looks like Firefox 1.5 changed the way the keypress event works. In previous versions, it only fired when character keys were pressed (as in IE), but in 1.5 it looks like it also fires for non-character keys, which is why backspace isn't working. I'm going to have to investigate and see what the best solution is.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/


Similar Threads
Thread Thread Starter Forum Replies Last Post
ch11 msxml3 code prob humayunlalzad BOOK: Beginning XML 3rd Edition 1 May 19th, 2007 02:38 AM
ch11 "Using XML and Ajax" example doesn't work nick_rasband@byu.net BOOK: Beginning Ruby on Rails 2 March 27th, 2007 06:13 PM
CMS doesn't appear to work with Firefox 1.5 abel714 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 September 18th, 2006 10:45 AM
Why does this work in Firefox but not in IE???? Ov1 Javascript 2 August 11th, 2006 05:47 AM
Errata,Code,Ch11,ListboxAddExample.htm din BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 January 17th, 2006 10:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.