发布网友 发布时间:2022-04-22 09:52
共6个回答
热心网友 时间:2022-05-18 08:46
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
</head>
<body>
<div id = "box"></div>
</body>
<script type="text/javascript">
var box = document.getElementById("box");
box.style.width='100px';
box.style.height='200px';
box.style.backgroundColor='red';
</script>
</html>
热心网友 时间:2022-05-18 10:04
举个例子吧:热心网友 时间:2022-05-18 11:38
<div id="test" style="border:1px solid #000;width:50px;height:50px;">这是测试的div</div>热心网友 时间:2022-05-18 13:30
先获取元素例如:var odiv = document.getElementsByTagName("div");热心网友 时间:2022-05-18 15:38
document.getElementById("div").style.height= "100px";热心网友 时间:2022-05-18 18:02
obj.width = "18px";