HG_long
2018-12-11 10:37
<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标签没粘贴全呀
JavaScript进阶篇
468061 学习 · 21891 问题
相似问题
回答 1
回答 3