JS object's Learning notes (for reference only)

Source: Internet
Author: User

First, the basic characteristics of object-oriented language:

Abstraction, encapsulation, inheritance, polymorphism

Encapsulation: Encapsulates abstract data and operations on data, data is protected internally, and other parts of the program are only manipulated by authorized operations (member methods) to manipulate the data

Inheritance: The ability of the properties and methods of a class to be derived from one or more classes, a class can inherit (Public/protect) properties and (Public/protect) methods in the parent class (extends), and inheritance resolves the code reuse problem

Polymorphism: The ability to write functions or methods that can run in multiple ways

JS Object Type: Local object, host object (Browser object), built-in object

Local object: An object that is provided independently of the ECMAScript implementation of the hosting environment, which simply means that the local object is the class defined by the EMCA-262 (reference Class). They include the array Boolean Date Function number String object RegExp Math Global and various Error object errors and so on

Host object: The object that executes the JS script that the environment provides for the object that its browser provides. So the local object is the host object, and all the BOM (window, Navigator, screen, history, location) and Dom objects are host Objects window, screen, location, history, Navigator, timing, popupalert, cookies

Built-in objects: all objects independent of the hosting environment, developers do not have to explicitly instantiate the built-in objects, it has been instantiated the Math Global also belongs to the local object

JS Browser object:

window: Represents a browser window or a frame in client-side JavaScript, where the Widow object is a global variable, so the expression is evaluated in the current environment.

The properties of the Window object and the Self property refer to itself. When you think of explicitly referencing the current window, rather than simply referencing it implicitly, you can use both attributes, the Parent property, the top property, and the frame[] array to refer to other window objects related to the current Window object.

Navigator: object contains information about the browser

Screen: object contains information for client display screens

History: Object contains URLs that users have visited

The History object contains the length property, which returns the number of URLs in the browser's re-historical list

The History method contains

Back () Loads the previous URL in the history list; the efficiency of calling the method is equivalent to clicking the rewind button to invoke History.go (-1);

Forward () loads the next URL in the History list, and invoking the method effect is equivalent to clicking the Forward button or calling History.go (1);

Go (unmber or URL) loads a specific page in the history list

Location: object contains information about the current URL

Properties contained by the Location object

The hash setting returns the URL (anchor) starting with the # sign

Host sets or returns the hostname and port number of the current URL

Hostname Sets or returns the host name of the current URL

HREF Sets or returns the full URL

Pathname Sets or returns a partial path to the current URL

Port Sets or returns the port number of the current URL

Protocol setting or returning a URL protocol

Search settings or return from? The starting URL (that is, the query section)

Method of the Location object

Assign (URL) to load a new document

Reload () Reloads the document, the method does not specify a parameter, or the parameter is false, and it uses the HTTP header if-modified-since to detect whether the document on the server has changed. If the document has changed, reload will download the document again. If the document does not change, the method will load the document from the cache

Replace () replaces the current document with a new document

JS object's Learning notes (for reference only)

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.