教程w3c网址http://www.w3school.com.cn/jsref/dom_obj_all.asp
1.<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#div1{
border: 1px solid red;
margin-top: 100px;
}
</style>
</head>
<body>asd
<div id="div1">
<span id ="span1" title="haha">1</span>
<span>2</span>
</div>
</body>
<script type="text/javascript">
var div1 = document.getElementById("div1");
var span1 = document.getElementById("span1");
span1.style.color = "green";
</script>
</html>
2.<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
div{
height: 100px;
width: 100px;
border:1px solid red ;
display: block;
}
</style>
</head>
<body>
<div></div>
<button type="button" onclick="close1()">点我</button>
<button type="button" onclick="start()">点我</button>
</body>
<script type="text/javascript">
function start(){
var div = document.getElementsByTagName("div")[0];
div.style.display="block";
}
function close1(){
var div = document.getElementsByTagName("div")[0];
div.style.display="none";
}
</script>
</html>