在範例練習中,寫錯成;
<p>Use the DOM to change my text!</p>
<script>
document.getElementsByTaName("p").innerHTML = "Change"
</script>
----
<head>
<title>W3Schools Demo</title>
</head>
<body>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"The title of this document is: " +
document.getElementByTagName("title")[0].innerHTML ;
----
<p id="demo">Hello World!</p>
<script>
document.getElementById("demo").style.backgroundcolor = yellow;
</script>
在此紀錄犯過的錯誤,
正解為:
document.getElementsByTagName("p")[0].innerHTML = "Change"
----
document.getElementById("demo").innerHTML =
"The title of this document is: " +
document.title ;
----
document.getElementById("demo").style.backgroundColor = "yellow";
沒有留言:
張貼留言