JavaScript Knowledge points Summary

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.