2. Prototype
CopyCodeThe Code is as follows :/**
* Person class: defines a person with a property name and a getname method.
*/
Function person (){}
Person. Prototype. Name = "Jack ";
Person. Prototype. getname = function () {return this. Name
(Function ($) {}) (jquery );
In fact, it is relatively simple to understand several concepts:
1. (). In JavaScript, () indicates executing a method, for example:
Function x (){
Alert ("XXX ");
}
VaR A = x; // no call. A is a function.
VaR A
Ttp: // www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd "target =" _ blank "rel =" external "> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> zoom in left zoom out left high magnification high reduction move left
Read XML files to strings
Step 1: convert an XML file into a DOM Structure
1
VaR xmldoc = Document. Implementation. createdocument ("", "test", null );
Xmldoc. Load ("D: \ develop \ bookmarks. xml ");
2
VaR Req = new XMLHttpRequest ();
Req. Open ("
Recently I learned Javascript. The following is an example (based on w3cschool)
In this example, a row is inserted after the row clicked by the mouse. By default, a row is inserted in the first row. You can enter the inserted content by yourself,
1. Disable right-click and copyMethod 1:
Add the following to the webpage:
Code:
Method 2:
Add the following code to :
Or
In essence, method 2 is the same as method 1.
Method 3:
If you only restrict replication, you can add the
Note: This document uses the firebug console object multiple times. For details, refer to the firebug console API. For more details about firebug, click here.
1. Replace = with =
There are two different equal operators in javascript: ===|! ==And
In the past, I always watched JS effects like this on the Internet:
Click Edit: (Sorry, the figure is at the end of the article)
The results of this list and editing are on the same page, which is really good and can bring unexpected good
I am always confused, so I searched on the Internet and checked the information. I am very depressed that there are not many posts about the usage of colons on the Internet, and they are not deep enough, after two days, I finally got a better
Jquery plugin
1.Jquery UI tabs
This tab script has been bound to the jqueryui library. It has many configuration items, such as rolling tabs and nested tabs.
2. jquery idtabs
Idtabs allows you to easily add a tab to a webpage, and
Let's test and modify the four outputs as a group output.CodeIs:
Copy code The Code is as follows: console. Group ('start group :');
Console. debug ('this is console. Debug! ');
Console.info ('this is console.info! ');
Console. Warn ('this is
Take the advantages of the first two methods:
A. Use constructors to define class attributes (fields)
B. Define the class method in prototype mode.
There is a third method. This method seems to be widely used by many people.
3. Integrated
CopyCodeThe Code is as follows:
If you have registered multiple keyboard listening events, although you modify the keycode value in the code segment, other keyboard listening events still obtain the original keycode. This is related to the
4. constructor + prototype directly assemble a class. The same constructor installs the same type in the group.
The previous articles show that JavaScript writing classes are based on constructors and prototypes. In this case, we write a tool
You do not need to use new array () or [];
Do not use new number, new string, or new Boolean.
Do not use new function to create a function
For example, if you want to write
CopyCodeThe Code is as follows: frames [0]. onfocus = new function
You can create a file on the visitor's hard disk through a browser, because I started to try it.
Code Copy to an HTML file and run it again!
Copy code The Code is as follows:
Did you find that the autoexec. BAT file on drive C is missing? In fact,
The EMCA262 specification does not have the class concept. The new JavaScript just makes it look more like c ++ and java. The writing class mentioned here is just the js Code style.
1. constructor Method
Copy codeThe Code is as follows :/**
* Person
Once and for all, do not duplicate the wheel :)
1. Uniform placement of common methodsFor example, when registering a user, you often need to determine whether the characters in the text box are Chinese characters, English letters, numbers, or
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