JavaScript is a global programming language that can be used for web development, mobile application development (PHONEGAP, Appcelerator), server-side development (Node.js and Wakanda), and so on. JavaScript is still the first language that many
The role of Try...catch is to test errors in your code.
Instance
Try...catch statement
How to write a Try...catch declaration.
Try...catch declaration with a confirmation box
Another example of writing a try...catch statement. JavaScript-Catch Error
Declare first: Each object in JavaScript has a constructor property and a prototype attribute. Constructor points to an object's constructor, prototype a prototype object that uses the object instance created with the constructor.
function
1. The object is suitable for collecting and managing data, so it is easy to form a tree-shaped structure.
JavaScript includes a prototype chain attribute that allows an object to inherit the properties of another object. Using it correctly can
JS Self-band function
Concat
Combines the text of two or more characters to return a new string.
var a = "Hello";
var B = ", World";
var C = A.concat (b);
alert (c);
c = "Hello,world"
IndexOf
Returns the index (search from left to
Copy Code code as follows:
function Checkmobile () {
var smobile = Document.mobileform.mobile.value
if (!) ( /^1[3|4|5|8][0-9]\d{4,8}$/.test (Smobile))) {
Alert ("Not a full 11-digit cell phone number or the correct number of the top
Roledeclaring a function, such as declaring a variable.Grammar
var c = 1;
Omit Varin JavaScript, if you omit the var keyword and assign it directly, the variable is a global variable, even if it is defined in a function.
Second, enhance the navigation function
1. Links in drop-down menu (links in Select menu)
Q: How do I implement a link to a different page in the Drop-down menu?
a: To create a drop-down menu as shown:Select a pageJavaScript
A Undefined type
Only one value undefined
In the following three cases typeof return type is undefined
1. When the variable is not initialized
2. When the variable is undefined
3. When the function does not have an explicit return value (the
Today is a brief introduction to the JavaScript dialog box and the status bar.
JavaScript and Dialog boxes:
Three kinds of dialog box diagram:In the client browser, three common window methods are used to pop up simple dialog boxes, which are
SetTimeout ()
The setTimeout definition of MDN is:
Calls a function or executes a code fragment after the specified delay time.
Grammar
The syntax for settimeout is very simple, the first parameter is a callback function, and the second
In JavaScript, creating an array can use the new array, and the following syntax is correct:
Arrayobj = new Array () creates an array.
Arrayobj = new Array ([size]) creates an array and specifies the length, not the upper limit, but the
In my opinion, the warning box is only used when the browser does not support other ways to display error messages. The Consortium recommends that we display an error message near the form item. This is a good idea, so we only use the warning dialog
In writing work-in-progress JavaScript book, I spent a considerable amount of time on the JavaScript inheritance system, and studied various scenarios for simulating classical class inheritance in the process. In these technical projects, I most
One of the advantages of JavaScript is how it handles asynchronous code. The asynchronous code is put into an event queue until all other code is executed, without blocking the thread. However, it may be difficult for beginners to write asynchronous
This method returns a string representing the specified Date object.Grammar
Date.tostring ()
The following are the details of the parameters:
NA
return value:
Returns a string representing the specified Date objectExample:
These days in doing a drag-and-drop element of the additional function, is to align to the grid, is actually to determine the initial position of good elements, and then drag elements, each move a fixed distance. Allow elements to be aligned within
3.1 Basic data types
1. String type: Consists of Unicode characters, numbers, punctuation marks, no char character type in JavaScript, even if only one character, must be used
2 digit (number): does not distinguish between integral and
First, the preface
In the past, JavaScript was used to do simple web effects, such as form validation, floating ads, and so on, so JavaScript didn't get much attention at the time. Since the start of Ajax, people have found that using JavaScript
From:http://www.nirvanastudio.org/javascript/improve-javascript-performance.html
Author: shiningray @ Nirvana Studio
With the development of the network and the speed of the machine, more and more websites use the rich client technology. Now Ajax
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.