<style type="text/css">
.message{
width:200px;
height:100px;
background-color:#CCC;}
</style>
</head>
<body>
<script type="text/javascript">
var p = document.createElement("p");
p.className = "message";
var text = document.createTextNode("I love JavaScript");
p.appendChild(text);
document.body.appendChild(p);
</script>
</body>
写的没问题,多提交几次,应该是检测错误
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.message{
width:200px;
height:100px;
background-color:#CCC;}
</style>
</head>
<body>
<script type="text/javascript">
var p = document.createElement("p");
p.className = "message";
var text = document.createTextNode("I love JavaScript");
p.appendChild(text);
document.body.appendChild(p);
</script>
</body>
</html>放在浏览器里有输出,你是不是head标签没粘贴全呀