two commonly used representations : JavaScript is a scripting language that must be placed between <script></scirpt> and can be placed in <body> or
Preferably put in
semicolon (;): Java is not the same as JavaScript, and Java does not add semicolons to the dead. Javasript is optional, preferably plus. ( But the case sensitivity is the same )
document.getElementById ("); Use the script statement to access an HTML element (the element to be accessed is identified with an ID, otherwise a browser incompatibility problem will occur)
document.getElementsByTagName ("); : Can return a collection with the specified tag name, return more, the elder brother is a SLR (very expensive.) Okay, don't make a mistake.
document.write (): Output content to the file (the entire HTML page will be overwritten if the document has been loaded and executed after the command is completed)
function: (equivalent to Java method?) ) keyword function
var: variable (unlike Java, he can become dynamic, one will be a string or a Boolean)
className : Returns the class attribute of the element because it is the same keyword as Java, remember it.
window.onload: When the document is loaded, everything inside will be loaded. I learned Window.onload=funciton today.
} JS has a benefit, so write not to write the name of the evil (equivalent to anonymous inner class?). )
if () {}for () {}while () {}switch () {}
JS in order to change the HTML of an attribute can only be changed, or to use the loop traversal.
JavaScript Beginner Essays