-
Notifications
You must be signed in to change notification settings - Fork 0
/
lunbo.html
40 lines (34 loc) · 1.18 KB
/
lunbo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!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" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>无标题文档</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<style type="text/css">
.div1{width:100px;height:100px;left:100px;top:100px;background:blue;position:absolute;}
.div2{width:100px;height:100px;left:250px;top:50px;background:red;position:absolute;}
.div3{width:100px;height:100px;left:400px;top:100px;background:yellow;position:absolute;}
</style>
<script>
window.onload=function(){
var oDiv=document.getElementsByTagName("div");
var oInput=document.getElementsByTagName("input");
var arr=[];
for(var i=0; i<oDiv.length; i++){
arr.push(oDiv[i].style.left,oDiv[i].style.top);
}
console.log(arr);
}
</script>
</head>
<body>
<div class="div1"></div>
<div class="div2"></div>
<div class="div3"></div>
<input type="button" value="往左" id="input1" />
<input type="button" value="往右" id="input2" />
</body>
</html>