1. All things are objects; All properties and methods belong to the window
document.getElementById (' id ') = window.document.getElementById (' id ')
A universal way to get the viewable area of a browser
var w = window.innerwidth | | Document.documentElement.clientWidth | | Document.body.clientWidth;
var h = window.innerheight | | Document.documentElement.clientHeight | | Document.body.clientHeight;
Window object
window.open ()-Open a new window
Window.close ()-Close the current window
Window.moveto ()-Move the current window
Window.resizeto ()-Adjusts the size of the current window
Location.hostname returns the domain name of the web host
Location.pathname returns the path and file name of the current page
Location.port returns the port of the web host (80 or 443)
Location.protocol returns the Web protocol used (HTTP///https://)
History.back ()-Same as clicking Back button in browser
History.forward ()-Same as clicking the button in the browser forward
Window.navigator Visitor's browser information
2, the object is the JSON format, the JSON format is also the object format: {A: ' A ', B: ' BBB '}
Object into JSON format json.stringify (obj);
3, JS all data are subordinate to Window:console.log (this);//object window
4. Function definition
Function ABC () {alert (' abc ');}
var abc = function () {alert (' abc ');}
5, the use of functions
ABC ();
6. Event: Events object (objects produced during event triggering) example
<script type= "Text/javascript" >
Function E (Eve) {
Eve = Event | | window.event;
Console.log (Eve);
}
Document.onkeydown = e;
</script>
<button onclick= "E (event)" >event</button>
JavaScript Knowledge points Summary