<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title></title>
<style>
div,p,ul,li{margin:0;padding:0;}
li{list-style: none;}
a{text-decoration:none;}
div{position: relative;}
body{}
.redCube{width:50px;height: 50px;background: red;position: absolute;}
#s{width: 100px;height: 100px;background: blue;}
</style>
<script>
window.onload=function(){
var b = document.getElementById("s");
alert(getStyle(b,'width'));
document.body.innerHTML+="<div class='redCube' ></div>";
alert(getStyle(b,'width'));
};
function getStyle(obj,attr){
return obj.currentStyle?obj.currentStyle[attr]:getComputedStyle(obj,null)[attr];
};
</script>
</head>
<body>
<div id="s"></div>
</body>
</html>
改变innerHTML为什么标题也跟着变???
webpack vue构建页面结束后怎么交给php?
构建工具能自动更新js的改变为什么不能自动更新index.html的改变?
请问该如何改变堆Heap中元素的值:数据结构问题?
相关分类