Wrox Programmer Forums
| 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 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
  #1 (permalink)  
Old October 5th, 2006, 03:27 AM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default SOLVED: How to recover element with eventutil.js

Hello,

I use "evenutil.js" to add events to my page. I add an event mouseover on an object:
Code:
EventUtil.addEventHandler(oDiv, "mouseover", fnc);
This is my html page:
Code:
<div><p>word1 <em>em word2</em></p></div>
Now I would like to recover my object oDiv in my javascript function "fnc". I should use that code:
Code:
var oEvent = EventUtil.getEvent();
var oDiv = oEvent.target;
But when I mouseover on my div, fallowing that I'm over "div" tag or "p" tag or "em" tag, I recover these different objects.
Is it possible to pass oDiv object to my function knowing that I use the same function for several "div" objects?

Thanks in advance,

Javata.
  #2 (permalink)  
Old October 5th, 2006, 03:50 AM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have found a solution:
In the "addEventHandler" function:
Code:
EventUtil.addEventHandler(oDiv, "mouseover", fnc(oDiv));
In the "fnc" function:
Code:
function fnc(oDiv){
  return function(){
     ...
  }
}
Very simple in fact
Regards,
Javata.



Similar Threads
Thread Thread Starter Forum Replies Last Post
TextUtil and EventUtil JasonF430 Javascript How-To 0 December 7th, 2008 10:59 AM
document.element isn't working in aspx page SOLVED logidude ASP.NET 1.0 and 1.1 Basics 2 June 29th, 2007 01:44 PM
Recover Deleted Records from MSSQL2000 hashimkply SQL Server 2005 1 January 15th, 2007 09:07 AM
Login Controls and Recover Password ~Bean~ ASP.NET 2.0 Professional 12 November 15th, 2006 03:13 PM
making EventUtil a class bradrice BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 2 August 29th, 2006 11:28 AM





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