The school textbooks are so rotten that they buy their own books.
It was the beginning of the classic, the opening of the Startled me ~
Nineth page ≯1.4/ch1_example2.html/
1 <Script>2 //Script block 23 document bgcolor="Red";4 Alert ("Second script block");5 </Script>
Run without passing, carefully examine the found
1 document BgColor should be Document.bgcolor
If you say ". "Written" is a clerical error, then "bgcolor" in JavaScript is a beginner's mistake.
HTML is not sensitive to capitalization, and it is unforgivable that code in <script> does not pay attention to capitalization .
JavaScript is sensitive to case-insensitive! JavaScript is sensitive to case-insensitive! JavaScript is sensitive to case-insensitive!
Then you should change the
1 document.bgColor= "Red" 2 3 or use CSS styles: 4 document.body.style.backgroundColor= "Red"
if both are used, first use the JavaScript style, and then CSS style, otherwise the following JS style is invalid. namely:
1 <Script>2 Document.bgcolor="Red"; //JS Style3 Alert ("Second script block");4 </Script>5 6 <Script>7 Document.body.style.backgroundColor="Blue";//CSS Styles8 Alert ("Third script block");9 </Script>
Specific reasons I do not know, just novice.
JavaScript Primer Classic (fifth edition)-Tsinghua Press's "classic" error