Search

12/30/2008

H! Hover Selector

H! Hover Selector
1. use row_hover.call(this);
2. use "row_hover" in window rather than typeof window["row_hover"]
3. this.runtimeStyle.behavior="none" for one-time css expression


tr {
behavior: expression(
/*you can remove these following comments, make it clearner*/
("row_hover" in window)
/*detect wherther window.row_hover is declared*/
? window.row_hover.call(this)
/*call window.row_hover from */
: window.row_hover =
/*declare window.row_hover if it`s not declared*/
/*pretty cool, let`s put JS function here, huh!*/
function() {;
this.runtimeStyle.behavior = "none";
/*OK, remove `s behavior since it had finish his job*/
this.onmouseover = function() {
this.className = "hover";
};
/*go on~*/
this.onmouseout = function() {
this.className = "";
};
/*go on~*/
});
/*OK, that`s it~*/
}

/*Let`s make it compatible for most modern browsers*/
tr.hover, tr:hover{background:#336699;color:white;}

沒有留言: