views:

370

answers:

3

On iPhone 3G, is it possible to fire onmouseover event on safari

A: 

Unfortunately that is one of the events the iPhone does not support :(

Sources: http://www.evotech.net/blog/2007/07/web-development-for-the-iphone/

Urda
Be sure to jump to the section "Safari on iPhone does not support:" in the article!
Urda
A: 

This works in WebKit. If iPhone Safari supports the event internally, this may work.

// Assuming the element you want to simulate a mouseover event with is "theElement"
var mouseoverEvent = document.createEvent('MouseEvents');
mouseoverEvent.initMouseEvent('mouseover');
theElement.dispatchEvent(mouseoverEvent);
eyelidlessness
+3  A: 

Yes and no, the behavior is not the same as on a computer, see this list for what triggers mouseover on the iphone.

adamse