JavaScript composition structure, graphical javascript Composition

Source: Internet
Author: User

[Graphic] javaScript composition structure, graphical javascript Composition

Can you briefly describe the basic structure of JavaScript scripts?

1. The javascript scripting language consists of three parts: ECMAScript, dom, and bom.
A ). ECMAScript is the host of a browser. You can regard it as a base function. all objects in javascript are derived from a large object in ECMAScript. different browsers have different implementations for ECMAScript (based on w3c ). therefore, JavaScript code in different browsers on the market must be compatible.
B). dom is the Document Object Model, that is, the html tree. dom allows you to use JavaScript to obtain the object of nodes in the dom tree so that you can operate on html elements.
C). bom is the browser object model. The browser manufacturer encapsulates the basic information of the browser in the bom object, such as the width, height, browser version, and core information of the window.
2. I personally think javascript is mainly used for Static html for user interaction. as the saying goes: Let html elements move. for example, add or delete a dom tree node. create a pixel animation and add event listening to the html control. and so on. I have to say that there is another ajax, that is, the asynchronous request triggered by js.
3. the most common methods for window objects are location (for page Jump and redirection) and escape (series) for url encoding. navigator (used to obtain the basic information of the browser), setTimeout timer, offsetWidth \ offsetHeight \ clientWidth, etc. (to obtain the height and width of the window ). for more methods, go to w3cschool.
4. The Date object method is as follows:
GetDate () returns a day (1 ~ 31 ).
GetDay () returns a day of a week from the Date object (0 ~ 6 ).
GetMonth () returns the month from the Date object (0 ~ 11 ).
GetFullYear () returns the year from the Date object in four digits.
Use the getFullYear () method instead of getYear.
GetHours () returns the hour of the Date object (0 ~ 23 ).
GetMinutes () returns the minute of the Date object (0 ~ 59 ).
GetSeconds () returns the number of seconds of the Date object (0 ~ 59 ).
GetMilliseconds () returns the millisecond (0 ~) of the Date object ~ 999 ).
GetTime () returns the number of milliseconds since January 1, January 1, 1970.
GetTimezoneOffset () returns the minute difference between the local time and Greenwich Mean Time (GMT.
GetUTCDate () returns the Day (1 ~ 31 ).
GetUTCDay () returns the day of the week (0 ~ 6 ).
GetUTCMonth () returns the month (0 ~ 11 ).
GetUTCFullYear () returns the four-digit year from the Date object based on the universal time.
GetUTCHours () returns the hour of the Date object based on the Universal Time (0 ~ 23 ).
GetUTCMinutes () returns the minute of the Date object based on the Universal Time (0 ~ 59 ).
GetUTCSeconds () returns the second of the Date object based on the Universal Time (0 ~ 59 ).
GetUTCMilliseconds () according to the world ...... the remaining full text>

Basic JavaScript Data Structure

JavaScript is a scripting language that supports the development of Web application client and server components. on the client side, it is used to compile the program that the Web Browser executes in the context of the Web page. on the server side, it can be used to compile and process information submitted by a Web browser and update the page displayed by the browser accordingly. In the previous introduction to HTML, we once mentioned that if you want to implement more interactive webpages, you must process data on the client and server, the client is mainly used in concert with the Script language of the client's web page technology. It plays a role in the design of web pages.
◆ Dynamic web page: JavaScript can develop two-way interaction functions with users, because it does not need to transmit data back and forth between the client and server, and has immediate response effect, because the program is executed directly in the browser.
◆ Form processing and verification: As the form field verification, check whether the Comment field is incorrect.
◆ Browser object: directly use browser objects to create complex webpage content, for example, opening a new window and loading a webpage. Of course, using JavaScript, we can also make various types of images, text, mouse, animation and page effects, and even make various client games! JavaScript can be inserted into HTML files for creation. To use JavaScript, insert it into an HTML file in the following format. JavaScript code
◆ LANGUAGE: Set the Script LANGUAGE type. If it is JavaScript, enter JavaScript. If it is VBScript, enter VBScript.
◆ SRT: Set the file name containing the path, for example, "C:/JScript/test. js ". The Script tag can be placed in the head or body of an HTML document. In most cases, it is best to place the Script tag in the document header to ensure that all JavsScript definitions in the Script are prior to the document subject.
◆ The description Statement of JavaScript uses a syntax similar to C ++ and JAVA. "//" indicates that the description ends at the end of the line, "/*" and "/*" indicate the content of the description. By using JavaScript, you can not only write simple text to the Document object, but also use JavaScript to generate HTML elements displayed in the current Document. Like other programming languages, JavaScript stores values with variables. variables can be used in other parts of the program. Variable names can start with uppercase letters (A-Z), lowercase letters (a-z), and underscores. Other characters can use letters, underscores, or numbers. Variable names are case sensitive. Different from other languages, JavaScript does not require you to specify the Data Type contained in the variable (or even not ). In fact, JavaScript can automatically recognize the entered number or symbol, so in JavaScript, you do not need to set the data type. On the other hand, JavaScript automatically converts different types. Therefore, we must track the numerical type of the variable and the conversion process in its variable expression.
JavaScript supports the following four basic numeric types. Integer: The integers are decimal, octal, and hexadecimal. In general, the hexadecimal value refers to a value between 0 and 15. In JavaScript, add "0x" before it to mark it as hexadecimal, in octal mode, "0" is added before 0-7 ". Floating Point Number: indicates the decimal point. A large number or a decimal point can also be a number represented by an exponential count. E indicates the index when the value is large. String: the string is identified by double quotation marks ("") or single quotation marks (') for use. The number in double quotation marks or single quotation marks is used as a string instead of a number. Therefore, these numbers cannot be calculated. NaN: NaN, or 'not a number', indicates the meaning of a non-digit. Enable the full text of... in JavaScript>

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.