Wrox Programmer Forums
|
BOOK: JavaScript 24-Hour Trainer
This is the forum to discuss the Wrox book JavaScript 24-Hour Trainer Jeremy McPeak; ISBN: 978-0-470-64783-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: JavaScript 24-Hour Trainer 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 December 5th, 2012, 03:42 PM
Authorized User
 
Join Date: Aug 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Lesson 21 Confused

Jeremy,

I'm getting lost at the beginning of Lesson 21. What's the relation between

Quote:
eventUtility.addEvent(document, "click", function(event) {alert(event);});
(p. 205)

and

Quote:
eventUtility.addEvent(link, "click", func);
(p. 203)?

I guess what I'm not understanding is:

Quote:
In actuality, the functions you wire to events should accept one argument, because...the browser passes an Event object to the function handling an event....
The eventutility, I thought, was built to assign a function (like addDigit) to the event. Why would we want to assign this alert to the event?

Are you saying the code on p 203,

Quote:
onload=function()
really should have an argument?

Thanks.
 
Old January 7th, 2013, 11:42 AM
jmcpeak's Avatar
Wrox Author
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 18 Times in 17 Posts
Default

You don't have to specify the parameter if you don't need it. Most of the time, however, you'll it defined even if it's not used. It's a practice the majority of people follow.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Lesson 21 Try It Cristina BOOK: Java Programming 24-Hour Trainer by Yakov Fain 0 March 28th, 2012 02:58 AM
Ex 21-3 SimpleEdit modification zavodney BOOK: Stephens' Visual Basic Programming 24-Hour Trainer 2 September 1st, 2011 08:24 PM
? p. 21 wrogers814 BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 2 September 9th, 2009 10:01 AM
Over 21 calculator - project PetraMan Javascript How-To 1 March 29th, 2005 09:44 AM





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