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 March 10th, 2008, 06:51 PM
Authorized User
 
Join Date: Nov 2005
Location: Taylor, Michigan, USA.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to horseatingweeds
Default How ch. 11 examples return false for ctrlKey?

I don't understand how bIsValidChar || oEvent.ctrlKey returns false for pressing the ctrl key. Won't hitting the ctlr key return false for bIsValide (null) then with the || (or) go to oEvent.ctrlKey which will return true?

Reply With Quote
  #2 (permalink)  
Old March 18th, 2008, 12:01 AM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You don't want to block the default behavior when the Ctrl key is pressed because it will interfere with normal textbox operations. So if the character is valid or if Ctrl is pressed, the function returns true so the default behavior continues. (bIsValidChar || event.ctrlKey) will never return false when the Ctrl key is pressed because that would block the default behavior.

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
onclick="javascript: return false" on vista gabrieldcr2 Javascript 2 June 4th, 2008 09:40 AM
Chapter 11 Code Examples ablinco BOOK: Professional VB 2005 ISBN: 0-7645-7536-8 0 October 9th, 2006 03:56 AM
Javascript return false won't stop post rstelma ASP.NET 1.0 and 1.1 Basics 9 March 16th, 2006 01:25 PM
return (false) crmpicco Javascript 1 October 24th, 2005 11:39 AM
Ch7 False Value Return on BuildSQLString Function Olivia54 BOOK: Beginning Access VBA 1 July 11th, 2004 09:22 PM



All times are GMT -4. The time now is 10:44 PM.


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