开发者

How to have hover effects on input boxes in Internet Explorer 6

Im looking how to have hover effects on input boxes in Internet Explorer 6? Im using YUI if I can utili开发者_C百科se that.

Thanks


Try this javascript:

var inputs = document.getElementsByTagName("input");
var hoverOn = function() {
    this.className = "hover";
};
var hoverOff = function() {
    this.className = "";
};
for (var i = 0, l = inputs.length; i < l; ++i) {
    inputs[i].onmouseover = hoverOn; 
    inputs[i].onmouseout = hoverOff;
}

And the CSS:

input.hover {
    background-color: #f0f;
}

Here's the above, which works in Firefox... let me know how IE6 goes... http://jsbin.com/aseli


HTML:

<input type="text" id="elementid" />

JS:

var oElement = document.getElementById("elementid"); 
function fnCallback(e) { alert("mouse over"); } 
YAHOO.util.Event.addListener(oElement, "mouseover", fnCallback); 

Taken from http://developer.yahoo.com/yui/event/#start

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜