Easy JavaScript Learning (1)

Source: Internet
Author: User

What is JavaScript?JavaScrjpt is a scripting language (scrptingIanguage) developed by Netscape ). Based on HTML, Javascript can be used to develop interactive Web pages. javascript allows a real-time, dynamic, and interactive relationship between the webpage and the user, so that the webpage contains more active elements and more dynamic content. to run a program written in Javascript, you must support a Javascript browser. Javascr is short and concise and executed on the client, which greatly improves the browsing bundle and interaction capability of the web page. at the same time, it is a simple programming language tailored specifically for the production of Web pages. Javascript is a scripting language that uses small program segments for programming. Like other scripting languages, Javascript also provides a simple development process; its basic structure is different from that of C and C ++. Unlike these languages, it needs to be compiled first, but is interpreted line by line during the program running. it is combined with HTML representation.JavaScript featuresObject-based and cross-platform dynamic javascript is dynamic and can respond directly to user operations without going through Web server programs. It is driven by an event, for example, if you click a button to submit or scroll the mouse, you cannot access local files, server files, delete, or other operations. This only enables interaction between webpages. JavaScript architecture [javascript] <script language = "javascript" type = "text/javascript"> // Add javascript code </script> data type 1. basic data types: numeric, String, logic, undefined, and null. composite data type objects, arrays, and functions because JavaScript is a non-type language, array elements can be any data type, and different elements of the same array can also have different types, the array element can also be another array. You can create a multi-dimensional array and declare it as follows: [javascript]/**************************** three methods for declaring arrays **** * ******************** // declare a non-type Array var strArray = new Array (); // declare an array with a length of 5 var strArray = n Ew Array (5); // declare an Array of five specified elements of a function var strArray = new Array (, 5 ); // The length attribute of the Array object is used to indicate the number of elements contained in the Array. var intNum = strArray. length; event processing mechanism click event button example: When you click event trigger, a prompt box is displayed, indicating that you click event trigger. Implementation Code: [javascript] <script language = "javascript" type = "text/javascript"> // function Click () {alert ("Click event triggered! ") ;}</Script> <body> // Add event Onclick =" javascript: Click () to the Click button () "event <input name =" Click "type =" button "align =" middle "value =" Click button "onclick =" javascript: Click () "/> </body> Javascript is a loose and dynamic type language. When declaring a variable, you do not need to specify the data type, which is more flexible and simple. We are familiar with Common Errors 1. case-sensitive functions such as function number () {} and function Number () {} are two different functions. 2. single quotation marks and double quotation marks JS do not require double quotation marks or single quotation marks, but to make the code readable, we use double quotation marks in HTML for JavaScript code. For example, [javascript] <script language = "javascript" type = "text/javascript"> // separate a single double quotation mark, make the code easy to understand var temp = '

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.