日期:2014-05-16  浏览次数:20327 次

用javascirpt动态改变css为何会导致ie崩溃?
页面代码
<html>
<head>
<title> </title>
<link   id= "link "   href= "big.css "   rel= "stylesheet "   type= "text/css "   />
<script   language= "javascript "   type= "text/javascript ">
function   change(){
var   e=document.getElementById( 'link ');
var   href=e.href;
if(href.indexOf( 'big ')> -1){
href=href.replace( 'big.css ', 'small.css ');
}else{
href=href.replace( 'small.css ', 'big.css ');
}
e.href=href;
}
</script>
</head>

<body>
<div   class= "box ">
</div>
<input   type= "button "   value= "change "   onclick= "change() "   />
</body>
</html>
=======================
big.css
.box{
width:400px;
height:300px;
background-color:#0099FF;
border:1px   solid   #000000;
}
=====================
small.css
.box{
width:200px;
height:150px;
background-color:#FF9933;
border:1px   solid   #000000;
}


------解决方案--------------------
...
没有问题啊

------解决方案--------------------
估计楼主装了MS那个不稳定的IEWebDeveloper