Wrox Programmer Forums
|
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
 
Old March 17th, 2006, 03:30 AM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default keydown/press

1) Chapter 9, p.284, "Keyboard events": the book states that both keydown and keypress events "occur repeatedly when key is held down".
However, with Mozilla (in Linux), I only see keypress events when holding down a key; for example, keyEventsExample2.htm (modified to print each event in one line, skipping print of arrKeys when empty) outputs, when pressing "a" and holding:

>event is keydown: target is txtInput, keyCode is 65, charCode is 0
>event is keypress: target is txtInput, keyCode is 0, charCode is 97
>event is keypress: target is txtInput, keyCode is 0, charCode is 97
......
>event is keypress: target is txtInput, keyCode is 0, charCode is 97
>event is keyup: target is txtInput, keyCode is 65, charCode is 0

So it seems that only the keypress is repeated. A small point, but just in case there is a misunderstanding.

2) [Premise: I am reading this book with a previous limited experience in JavaScript]. In Chapter 6, "Checking the node type", p.169, I suddenly found a notation that was never presented before (varNode= ...), which looked similar to a Perl hash reference (replacing the "=>" with ":"). I then found on the web that it is indeed the JavaScript "associative array".
Perhaps, the data type could be added to the first chapters in the 2nd edition of the book (if I am right that it does not appear; I may have missed it, of course, given the amount of information).

(Remarkable book, by the way; what a methodic, colossal effort. I look forward to the next one on Ayax, after I complete this one).

raul
 
Old March 17th, 2006, 09:34 AM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Hi Raul,

I'm glad you enjoyed the book. In regards to your comments, first, I'll have to look into the keypress/keydown event issue. At the time of my writing that book, Firefox 1.0 had just come out, and it's possible that subsequent versions altered the behavior.

For your second comment, that may be a good idea. The problem is that, technically, there is no "associative array" in JavaScript, only objects...which happen to act like associative arrays. But I understand your point, and perhaps the topic should be introduced earlier in the book. I have added this to my "wish list" for a second edition. :)

Nicholas


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





Similar Threads
Thread Thread Starter Forum Replies Last Post
DatagridView Keydown Event senpark15 C# 0 June 28th, 2008 12:34 AM
C# Control.KeyDown Not Working 17beach C# 2 September 21st, 2006 02:40 AM
How to hijack backspace onkeypress (or keydown)? scubaduba Javascript How-To 1 November 8th, 2004 05:41 AM
Hi,HuhOic.(How to use keydown event) zhangxujun1981 C# 1 September 20th, 2004 07:17 PM
How to use KeyDown event in Form zhangxujun1981 C# 5 July 6th, 2004 02:07 AM





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