我在body标签里加了div,然后把元素插入到div里怎么就没有结果???
我在body标签里加了div,然后把元素插入到div里怎么就没有结果???
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style type="text/css">
.message{
border:8px;
width:200px;
height:100px;
background-color:yellow;}
</style>
</head>
<body>
<div>
</div>
<script type="text/javascript">
var yuanshu=document.createElement("p");
yuanshu.className="message";
var wenzhi=document.createTextNode("i love coding");
yuanshu.appendChild(wenzhi);
document.div.appendChild(yuanshu);
</script>
</body>
</html>