Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 16th, 2006, 09: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?


Reply With Quote
  #2 (permalink)  
Old January 16th, 2006, 10: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.


Reply With Quote
  #3 (permalink)  
Old January 18th, 2006, 08: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/
Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 09:28 AM



All times are GMT -4. The time now is 12:20 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.