使用setAttribute为什么不行
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style type="text/css">
.message{
width:200px;
height:100px;
background-color:#CCC;}
</style>
</head>
<body>
<script type="text/javascript">
var ptag=document.createElement("p");
p.setAttribute("name","message");
var textnode=document.createTextNode("I love u");
ptag.appendChild(textnode);//变量不要加双引号,否则无效
document.body.appendChild(ptag);
</script>
</body>
</html>