解决IE6不支持除a以外:hover的问题
2012-05-12 09:39
411 查看
<script language="javascript">
stuHover = function() {
var cssRule;
var newSelector;
for (var i = 0; i < document.styleSheets.length; i++)
for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
{
cssRule = document.styleSheets[i].rules[x];
if (cssRule.selectorText.indexOf("LI:hover") != -1)
{
newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
}
}
var getElm = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<getElm.length; i++) {
getElm[i].onmouseover=function() {
this.className+=" iehover";
}
getElm[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" iehover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", stuHover);
</script>
stuHover = function() {
var cssRule;
var newSelector;
for (var i = 0; i < document.styleSheets.length; i++)
for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
{
cssRule = document.styleSheets[i].rules[x];
if (cssRule.selectorText.indexOf("LI:hover") != -1)
{
newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
}
}
var getElm = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<getElm.length; i++) {
getElm[i].onmouseover=function() {
this.className+=" iehover";
}
getElm[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" iehover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", stuHover);
</script>
相关文章推荐
- 解决IE6不支持除a以外:hover的问题
- 一个解决ie6不支持:hover、属性选择器等问题的方法
- 两种办法解决IE6下非链接不支持hover的问题
- 解决IE6不兼容问题(a:hover以外一切都不执行)
- 解决ie6不支持:hover、属性选择器等问题的方法
- 利用JS解决ie6不支持max-width,max-height问题的方法
- [Javascript] 解决 IE6 中 png 图片背景不支持透明效果的问题
- csshover.htc 以及简单使用方法(解决IE6下 :hover 在其他标签下无效问题)
- IE6不支持max-width和min-height解决问题
- 解决IE6不支持PNG-24透明的问题
- 解决window.opener=null;window.close(),只支持IE6不支持IE7,IE8的问题
- 解决IE6不支持position:fixed问题
- 解决PNG图片在IE6下背景不透明的问题让IE6支持PNG透明背景
- 解决IE6不支持position:fixed;的问题
- 解决IE6下的CSS Hover背景图片闪烁问题
- IE6不支持PNG透明问题的解决办法
- 使用jquery解决ie6、7、8、9版本不支持placeholder的问题。
- 使用DD_belatedPNG让IE6支持PNG透明图片 及IE6下背景图闪烁问题的解决方法
- 解决IE6支持PNG图片透明问题
- css3 @media支持ie8用respond.js 解决IE6~8的响应式布局问题