<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
<style>
.mo{
background:red;
width:500px;
height:500px;
}
</style>
</head>
<body>
<div id="mo">hello</div> //DOM命令下控制css;
<img src="dog.jpg" id="pid"> //DOM命令下控制图片,网址;
<a href="http://www.baidu.com" id="pid">百度</a>
<button οnclick="demo()">按钮</button>
<script>
function demo(){
document.getElementById("mo").style.background="blue"; //DOM命令下控制css;
document.getElementById("pid").src="cat,jpg"; //DOM命令下控制图片,网址;
document.getElementById("pid").href="http://www.jike.com";
}
</script>
</body>
</html>