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 Search this Thread Display Modes
  #1 (permalink)  
Old August 21st, 2006, 08:15 AM
Registered User
 
Join Date: Jul 2006
Location: Lodi, OH, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default making EventUtil a class

I'm trying to make a set of divs that will be dynamically added to a page draggable. I have been trying to decide the best way to go about it. I created a dragDiv class that I instantiate for each div. I've considered changing the EventUtil code so it becomes a class and then have the dragDiv class inherit the EventUtil code, so each div I instantiate will have it's own set of handlers. Does it sound like I am going in the right direction? On page 292 you say because there are no properties (for the EventUtil object) and you only need one instance of this object, there's no need to define a class. It makes me think that I'm not going about my code correctly.

Reply With Quote
  #2 (permalink)  
Old August 25th, 2006, 09:42 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

EventUtil is exactly what it says: a utility for working with events. You don't need to inherit from it. You can create methods to add event handlers to the DIV you want to drag directly on your dragDiv class.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Reply With Quote
  #3 (permalink)  
Old August 29th, 2006, 11:28 AM
Registered User
 
Join Date: Jul 2006
Location: Lodi, OH, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

By the way your book is awesome. I've read and re-read it so many times it is very dog eared. I rarely do that to a book. But the drag and drop is giving me fits. I just located your zDrag lib and am going through that. I think that is more what I am looking for. I was trying to adapt the simulatedDragAndDrop code to my page. I have multiple divs that I want to be draggable and have been trying to figure out how to do it without wrting methods for each one. I don't want to do getElementById inside of the functions, but somehow pass it the div I am wanting to drag.

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
TextUtil and EventUtil JasonF430 Javascript How-To 0 December 7th, 2008 10:59 AM
EventUtil class not working in web server KelRegor BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 2 December 26th, 2007 09:50 AM
SOLVED: How to recover element with eventutil.js javata BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 October 5th, 2006 03:50 AM
Regarding Class Library (.dll) from class file manish.sharma04 BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 March 3rd, 2006 07:32 AM
making a class in visual c++ .net. fbailey Visual C++ 0 April 26th, 2004 07:09 AM



All times are GMT -4. The time now is 07:22 PM.


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