1, JavaScript code must be placed <script> tag between </ script>
Such as: <script> document.getElementById ( "demo") innerHTML = "content"; </ script>.
2, is a JavaScript function JavaScript code block is executed when called
Such as: <script>
function myFunction(){
. Document.getElementById ( "demo") innerHTML = "content";
}
</script>
<p id="demo">原内容</p>
<Button type = "button" onclick = "myFunction ()"> Click I call the function </ button>
3, ①JavaScript script in the <head>
②JavaScript script in the <body>. Put <body> element of the bottom of the display speed can be improved, because the script compile slow down the speed
③JavaScript script references by external .js file
<script src="路径"></script>