Event-driven events in JavaScript are triggered by mouse or hot key actions as follows:
1. Click the event onclick as follows: ()
It is usually used for the following controls:
Button ObjectCheckbox check box or check list-with onclick click
Javascript uses regular expressions to implement startwith and endwith Functions
CopyCode The Code is as follows: String. Prototype. startwith = function (STR ){
VaR Reg = new Regexp ("^" + Str );
Return Reg. Test (this );
}
String. Prototype.
As follows:
Page code:
Copy codeThe Code is as follows:
Display Effect of Baidu youah topic
graph boxing do not trap yourself. You need to release it! overall evaluation: User impression: active active User rating
The following function receives a parameter, which can be an array or an element and returns the text of the element.
Copy codeThe Code is as follows: function text (e ){
Var str = "";
// If an element is input, obtain its child element.
//
Var reg =/regular expression /;
Boolean reg. test (string to be verified );
The js engine converts/Regular Expressions/"" into a RegExp object. If the string meets the requirements of regular expressions, true is returned.
An example of expression
Html dom refers to some dom operations supported by various browsers before w3c standards emerge.
1. Select object.
Attribute
A, selectedIndex: subscript of the selected option. The subscript starts from 0.
B, length: Get or set the number of
I. concepts:
1. The mouse event has a botton attribute: return an integer to indicate which mouse button is clicked.BUG: in IE and standard DOM mouse events, the only event with the same button property value is the "right-click" event, both return 2
The encapsulated motion frame Move (obj, attr, iTarget) can be called directly:
It can be used to set variable speed changes of many common attribute values, such as width, border, fontSize, marginLeft, and opacity, to achieve a variety of
Inheritance Method
ECMAScript implements inheritance in more than one way. This is because the Inheritance Mechanism in JavaScript is not clearly defined, but achieved through imitation. This means that all inheritance details are not completely
Declared global variables in JS are mainly divided into explicit declaration or implicit declaration.
Method 1:
Using var (keyword) + variable name (identifier) is declared outside the function, that is, global variables. Otherwise, local variables
Variable naming rules should also comply with the following famous naming rules:
Famous variable naming rulesCamel taggingThe first letter is lowercase, and the subsequent letters start with an uppercase letter. For example:
Copy codeCode: var
I. Basic Concepts
EncodeURI and decodeURI are used in pairs. Because the address bar of the Browser contains Chinese characters, unexpected errors may occur. Therefore, encodeURI can convert non-English characters into English encoding, decodeURI
In JS, the Create Object is not exactly the class Object that we often call to Create. The objects in JS emphasize a composite type, creating objects in JS and accessing objects are extremely flexible.
Javascript objects are a composite type that
Recently, more and more users have emphasized the interaction of the UI interface. JavaScript (JS), which is just a supporting role, has gradually become the main character for a dragon and occupies a major role.
For example, the recently popular
I am writing a DEMO today, where $. after the getJSON method is completed, it is found that jQuery is used in the entire DEMO, but it is not cost-effective to introduce a jQuery method. Therefore, a simple version is implemented by yourself, the
1. embedded into HTML1. Place the Javascript code directly between 2. Create an external js File Based on the src attribute marked by
4. In the same script, the function definition can appear after the function call, but if it is in two sections of
Generally, the two call results are the same, but there are still differences.
Method 1:
Copy codeThe Code is as follows: function (){
Alert ('Old ');
}
Var B =;
Function (){
B ();
Alert ('new ');
}
A (); // memory overflow occurs in the
Constructor
Copy codeThe Code is as follows: function coder ()
{
This. name = 'modern magic ';
This. job = 'web developer ';
This. coding = function ()
{Alert ('Code I am writing ');}
}
Var coder = new coder ();Alert (coder. name );Coder. coding ();
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