CSS Compound Effect
The effect of CSS can overlap. For example, if class = "a B" is used, the node has both the attributes of a and B, and B can overwrite the attributes of.
Execution sequence of Javascript in HTML
After a simple test, we found that the execution sequence of JavaScript is based on the loading sequence of JS, while the onload function is executed only after the whole page is loaded.
My test files:
<! -- <Br/> to change this template, choose tools | templates <br/> and open the template in the editor. <br/> --> <br/> <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en"> <br/> <HTML> <br/> <pead> <br/> <title> </title> <br/> <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8 "> <br/> <MCE: script language =" JavaScript "type =" text/JavaScript "> <! -- <Br/> alert ("Js in the header! "); <Br/> function loadon () {<br/> alert (" onLoad! ") <Br/>}</P> <p> // --> </MCE: SCRIPT> <br/> </pead> <br/> <body onload = "loadon ()"> <br/> todo write content <br/> <MCE: script Language = "JavaScript" type = "text/JavaScript"> <! -- <Br/> alert ("before the </body>"); </P> <p> // --> </MCE: SCRIPT> <br/> </body> <br/> </ptml> <br/>
Execution result:
We can see that:
The JS Code in the header is loaded first, so it is also executed first.
Second loading in the body
Onload is loaded after the body is fully loaded. Therefore, it is executed only after the Js in the body is executed.