Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| 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 Search this Thread Display Modes
  #31 (permalink)  
Old June 20th, 2005, 09:58 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

Right again, Alexei, I'll submit it to Wrox.

Thanks!

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Reply With Quote
  #32 (permalink)  
Old June 20th, 2005, 02:13 PM
AGS AGS is offline
Wrox Technical Editor
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2005
Location: Russia
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Page 320, next to last paragraph
Quote:
quote:As you can see, oRange1’s startContainer, endContainer, and commonAncestorContainer are equal
to the <body/> element because the <p/> element is wholly contained within it. Also, startOffset is
equal to 0, because the <p/> element is the first child of <p/>, and endOffset is equal to 1, meaning that
the range is over before the second child node (which is index 1).
<p/> element is the first child of <body/>?

Best regards,
Alexei

Reply With Quote
  #33 (permalink)  
Old June 23rd, 2005, 10:48 AM
AGS AGS is offline
Wrox Technical Editor
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2005
Location: Russia
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Page 171, next to last code block
Code:
var oPs = document.getElementsByTagname(“p”);
var oImgsInP = oPs[0].getElementsByTagName(“img”);
Typo (getElementsByTagName)

Best regards,
Alexei


Reply With Quote
  #34 (permalink)  
Old June 24th, 2005, 04:14 AM
AGS AGS is offline
Wrox Technical Editor
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2005
Location: Russia
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Page 327, last code block
Actually I had some hesitations concerning this topic but still...
Code:
var oP1 = document.getElementById(“p1”);
var oP2 = document.getElementById(“p2”);
var oRange = document.createRange();
oRange.setStartAfter(oP1);
oRange.setStartBefore(oP2);
alert(oRange.collapsed); //outputs “true”
Quote:
quote:In this case, the created range is collapsed because there is nothing between the end of p1 and the beginning
    of p2.

I would say that in this case the created range is collapsed because we didn't set the end of the range. May be selected line should be
oRange.setEndBefore(oP2); or may be I missed the point.
And another reason: according to my experiments :) if you try original code and there are indeed other nodes between p1 and p2 you'll get
Quote:
quote:Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMRange.setStartBefore]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://localhost/ranges.html :: compareRange :: line 16" data: no]
Best regards,
Alexei
Reply With Quote
  #35 (permalink)  
Old June 27th, 2005, 09:57 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

Alexei, you're right on both counts. I suspect the incorrect capitalization was due to Word's "autocorrect" features. The range issue is undoubtedly a copy-paste oversight.

Thanks,
Nicholas

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Reply With Quote
  #36 (permalink)  
Old June 27th, 2005, 10:49 AM
PC PC is offline
Registered User
 
Join Date: Jun 2005
Location: Roma, , Italy.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi!

Some possible errors or missprint.

Page 45.

In first example we have a variable bTrue, but in paragraph following the example, last sentence we find "so that a is set to false", maybe bTrue? (maybe the sentence will be changed...).

Page 46.

" ...the variable c is undefined." bUnknown?

Page 52

Conditional operator last sentence "...iNum2 is less than..." Maybe great than?

Page 67

Last paragraph "As discussed briefly in Chapter 1, ..." Maybe Chapter 2?

Page 69

First paragraph. "In Chapter 1..." Chapter 2?

Page 78

In using UTC(), in paragraphs we find 2004, but in examples 2003?
I've lost something how use UTC()?

Page 84

Second table LOG10E Description "The base 1 logarithm of E". Isn't base 10?

I have a question on using return in function, but I'll send as new topic. It's a stupid question but I'd like understand more...

Bye.

Paolo
Reply With Quote
  #37 (permalink)  
Old June 27th, 2005, 11:27 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

Paolo,

You are right on all counts, these are all mistakes and need to be fixed. Thanks so much for point this out to me. If you find any other mistakes, don't hesitate to post them.

Thanks,
Nicholas

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Reply With Quote
  #38 (permalink)  
Old July 8th, 2005, 02:21 AM
AGS AGS is offline
Wrox Technical Editor
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2005
Location: Russia
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

May be it doesn't fit this topic but I am more comfortable to post it here :).
Chapter 11, page 346.
(CodeExamples formutil.js -> FormUtil.tabForward)
Code:
    for (var i=0; i < oForm.elements.length; i++) {
        if (oForm.elements[i] == oTextbox) {
             for(var j=i+1; j < oForm.elements.length; j++) {
                 if (oForm.elements[j].type != "hidden") {
                     oForm.elements[j].focus();

I've tried to use this function in current project and stumbled upon following issue:
While "tabforwarding" through controls I got an error "Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus." The reason was that next control was disabled (I think it’s quite common case). Firefox unlike IE doesn’t raise an error but stops on this control anyway. So may be it would be appropriate to add this condition:
Code:
if (oForm.elements[j].type != "hidden" && !oForm.elements[j].disabled)
After further experiments I've found another peculiarity: I think there must be preconditions concerning some keys (at least "Shift"). It is quite difficult to select text of "full" textbox because focus always tries to escape to next control :).
And, yes, I am aware that examples in the book were not intended to be of production quality. So notes above are just thoughts about some improvements of this particular method and again I probably should post it in different topic. But what's done can't be undone .

Best regards,
Alexei
Reply With Quote
  #39 (permalink)  
Old July 9th, 2005, 07:50 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

Very interesting find. I had never tried it with disabled controls, that's a good catch! Your code update is probably the best approach.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Reply With Quote
  #40 (permalink)  
Old September 13th, 2005, 01:12 AM
AGS AGS is offline
Wrox Technical Editor
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2005
Location: Russia
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Page 273
Misprint: duplicate property name pageX instead of pageY.
Best regards,
Alexei

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
mistake in code yami56 Access 3 February 24th, 2005 04:04 PM
mistake in my topics zakarya_hazara Classic ASP Basics 1 October 9th, 2004 02:49 AM
Dangerous mistake revinchalil SQL Server 2000 4 February 4th, 2004 12:06 PM



All times are GMT -4. The time now is 03:21 PM.


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