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 August 21st, 2006, 08:15 AM
Registered User
 
Join Date: Jul 2006
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.

 
Old August 25th, 2006, 09:42 PM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
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/
 
Old August 29th, 2006, 11:28 AM
Registered User
 
Join Date: Jul 2006
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.






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





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