Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript 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 July 30th, 2005, 09:45 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Default what my mouse is on?

hi all,
I want to know somehow on what my mouse is.assume there's a <td> tag and my mouse is just on top of it without firing any event of the td.(for example after clicking the ok button of the alert window the mouse cursor drops on the td without firing any event of the td).
how shall I get the id of the td?


 
Old August 2nd, 2005, 08:05 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's about 3 days and no answer but I found one for IE at least:
  window.status=document.elementFromPoint(window.eve nt.x,window.event.y).id;
The id of the most inner element on which you mous is...


 
Old August 3rd, 2005, 05:09 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi Nerssi,

Try this
<script>
function check(obj)
{
window.status=obj.id
}
</script>

<table>
<tr>
<td id="my1" onmouseover="check(this)">hello1</td>
</tr>

<tr>
<td id="my3" onmouseover="check(this)">hello3</td>
</tr>

<tr>
<td id="my2" onmouseover="check(this)">hello2</td>
</tr>

<tr>
<td id="my5" onmouseover="check(this)">hello5</td>
</tr>

</table>
Hope this will help you
Cheers

Cheers :)

vinod
 
Old August 9th, 2005, 01:34 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx vinod but that's not what I meant!

With onmouseover event you'll have to move a mouse a bit to make the event fired...
In my issue, the mouse has no movement and still you need to know what the object id is:
To see that your solution does not work with this put and call an alert() function on your page and then move your mouse on top of one of the td tags and then press enter so that the alert will be closed and your mouse is on top of that td tag...you'll see that the onmouseover wouldn't fire and you have no id in hand until you move your mouse a bit...
And event if it would work, it ain't reasonable to put onmouseover in every tag of your page...
By far document.elemenFromPoint has been the best solution. Such a pity that it works only on IE.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse Ravikiran VB.NET 1 June 8th, 2007 04:57 PM
Where's my mouse? Giant_robot_sandwich Javascript How-To 2 January 9th, 2007 09:22 AM
On Mouse Over teresagoh Javascript 1 February 13th, 2006 10:11 AM
mouse wheel aytacakin Pro JSP 0 November 16th, 2005 04:01 AM
mouse wheel aytacakin Javascript How-To 1 November 15th, 2005 12:10 PM





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