i need to be able to find out if the mouse is over an element.
would it be something like
thanks for any helpCode:doument.getElemntById('id').mouseover
i need to be able to find out if the mouse is over an element.
would it be something like
thanks for any helpCode:doument.getElemntById('id').mouseover
Code:doument.getElemntById('id').onmouseover=function(){alert('Ta Da!');}
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
thanks but i need to be able to use it in if
Code:if (doument.getElemntById('id').mouseover) { alert('ok') } else { alert('end') }
Unless you want to track the position of the mouse over the document which is rather resource intensive but can be done, comparing it to the x, y, rightedge and bottomedge of your element, you can just create a global variable:
Then either through script, as in my previous example, or in the HTML code, assign onmouseover and onmouseout events to your element which include (they can do other things as well) for example in HTML:Code:var overel=0;
Then you can do:HTML Code:<div onmouseover="overel=1" onmouseout="overel=0">Content for this division</div>
Code:if (overel) { alert('ok') } else { alert('end') }
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
WOW i was dumb when i posted this question lol. normal i would of just used your first reply and done what you did in you second post. thanks anyway
Bookmarks