开发者

Use hover or onmouseover/onmouseout?

I am building custom buttons(sliding doors) for a new website. The buttons will not trigger a link but a javascript that then submits the form.

My solution is to use div (instead of link) with span within.

The question is if I should use onmouseover/onmouseout or is hover a preferred?

Pleas note : My website demands javascript else it wont work at all, so there is no problem to use javascript for the button, the question is which wa开发者_如何转开发y that is the most correct?


I would do it with CSS because it would require less code and it would work with Javascript disabled


If you are talking about jQuery events, it doesn't matter, it's the same.

If you're talking about HTML onmouseover/onmouseout vs. CSS:hover, go for CSS:hover. It's far easier to maintain, looks cleaner and decreases the size of your HTML which is a mess most times, anyways.


The solution for this is to simple use onmouseover/onmouseout on the div element. It will generate some code but it will be safe to use even in IE6.

This will ofcource demand javascript but that will have to do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜