為什么文字輸出是undefined
<!doctype html>
<html>
?<head>
? <meta charset="UTF-8">
? <meta name="Generator" content="EditPlus?">
? <meta name="Author" content="">
? <meta name="Keywords" content="">
? <meta name="Description" content="">
? <title>Document</title>
<style type="text/css">
.message{? ??
width:200px;
height:100px;
background-color:#CCC;}
</style>
</head>
<body>
<script type="text/javascript">
var newp=document.createElement("p");
newp.className="message";
var newText=document.createTextNode("I love JavaScript!").value;
newp.innerHTML=newText;
document.body.appendChild(newp);
</script>?
</body>
</html>
2019-08-24
value代表的是該標(biāo)簽的屬性,不等同于它的文本內(nèi)容