<style>
div{width:400px;height:400px}
</style>
</head>
<body>
<div>
</div>
<script type="text/javascript">
function changecss(obj,json){
for(var i in json){
obj.style[i]=json[i];
}
}
var box=document.getElementsByTagName('div')[0];
changecss(box,{background:'red',width:'200px'});
</script>
用for in反射来无限制的修改css
最新推荐文章于 2024-05-22 19:50:39 发布