现在有这样一句
aDiv[i].style.display="none";
chrome完全没问题,但是IE9好像就没用。aDiv是数组,里面存着div节点对象,请问该怎么改才能让ie9兼容呢?
javascript
ie9
兼容
------解决方案--------------------
jquery方案
$("aDiv[i]").hide();
IE9问题多多,不支持那个属性确实没太好的办法
------解决方案--------------------
我的IE是10用开发者工具切换到9模式下面正常工作呀
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<p>h</p><p>t</p><p>t</p><p>p</p>
<script type="text/javascript">
var aDiv=document.getElementsByTagName('p');
aDiv[2].style.display="none";
</script>
</body>
</html>
估计还是你的代码有问题
------解决方案--------------------
IE9的.style确实没效果
我的IE9这个就没效果,浏览器问题
------解决方案--------------------
用setAttribute呢?