Jump to content
sajan

How pass mouse event?

Recommended Posts

Hi How can we pass mouse events through a dynamically generated elements function?eg

newdiv.onmousedown = function(){fn_name(divname,event);}

when i pass the event i get undefined.What may be the reason?

Share this post


Link to post
Share on other sites

Try this.

newdiv.onmousedown = function(event){fn_name(divname,event||window.event);}

Share this post


Link to post
Share on other sites

or, since the function is being called from a pre-set onmousedown event, you could just pass 'mousedown' as a string to the function.

Share this post


Link to post
Share on other sites

Vow vow thats great .its working. many thanks Deirdre's Dad .u saved my day.Also i like to know the difference between pageY and clientY.i got [pageY 834 and the same clientY is 314.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...