What should I do ?! Like an animal (composite object), when it gives birth to a descendant (leaf object), its descendant has a certain function (such as digging holes and hearing well ); it is also like a tree, which has a root (composite object)
The string processing functions of JavaScript native are not rich enough,
Native string function: http://www.jb51.net/w3school/js/jsref_obj_string.htm
Question 1: Is there any extension library for the string type?
Yes, not many, not comprehensive.
What I want to talk about today is how to write classes and static classes in Javascript. This is my usual method. You can also make it easier, or send comments to communicate with you.
First, let's talk about the class. In a class, we have the
Today, I saw a script on the Internet to obtain elements based on classname, which is recorded here for future use.
CopyCode Code: var getelementsbyclassname = function (searchclass, node, tag ){
If (document. getelementsbyclassname ){
Return
Written as follows:
This method is called when the onxxxevent () event of the acitvex control is triggered.
If you have a half, dozens of such functions fill up my pages. Besides, in vs2008, "setting selected content formatting" always prompts
1.doc ument. Write (""); Output statement
2. Comments in JS are //
3. The traditional HTML document sequence is: Document-> HTML-> (Head, body)
4. the DOM sequence in a browser window is: window-> (navigator, screen, history, location,
FirstCode:
Copy code The Code is as follows:
No title page
New data () is used to avoid the automatic cache of the showmodaldialog page. As a result, the page is opened for the second time and the data is not refreshed, this is
This title is easy to read, but it is the key to understanding the data structure. The four terms in the title correspond to shallow copy (note, not shadow copy), deep copy, pass by value, pass by reference (or pass by address ). It is one thing to
Let me define it as follows:
CopyCode The Code is as follows: function getdate (){.....}
Function getdate (date ){.....}
The next method will overwrite the previous one, although no error is reported.
But we can indeed implement overload. If
Mode type: factory Mode
Mode Description: One of the common modes used to dynamically create objects
Applicability: classes that need to be selected in a series of interchangeable subclasses during running
Note: The implementation of interfaces so
In JavaScript, we can use the prototype keyword to add new attributes or methods to an object. The following is a method for adding the binary search function to an array object:
CopyCode The Code is as follows: array. Prototype. binarysearch =
But I don't know if you have encountered such a situation. The new window is opened through instead of window. opener or showmodaldialog.
In particular, note that the address (PAGE) pointed to by this href is not developed by us. For example, we
Front-end
Code
Copy code The Code is as follows:
VaR;
Function checkall (){
If (A = 1)
{
For (VAR I = 0; I {
VaR E = form1.elements [I];
E. Checked = false;
}
A = 0;
}
Else
{
For (VAR I = 0; I {
VaR E = form1.elements [I];
E. Checked =
Method 1: Cookie operations,CodeEncapsulation. The following methods are also available for your reference.
Copy code The Code is as follows: String. Prototype. Trim = function ()
{
Return this. Replace (/^ \ s +/g, ""). Replace (/\ s + $/g ,"");
}
CopyCode The Code is as follows: function a (x)
{
This. x = X;
}
VaR OBJ = new A (5 );
Alert (obj. X );
This code is very simple, but what is important is that we have seen a very surprised result. obj is assigned a property X, just like when we
Core
Code :
Copy code The Code is as follows: var T $ = function (ID) {return document. getelementbyid (ID );}
VaR $ extend = function (DES, Src) {for (var p in SRC) {des [p] = SRC [p]} return des ;}
VaR bubble = function (){
// Random ball
Using a class library can easily solve compatibility issues. But what is the mechanism behind this? Let's talk about it a little bit.
First, Dom level2 defines two functions for event processing: addeventlistener and removeeventlistener, both of
JavaScript is an indispensable part of Web development and design. Whether it is a simple Web page or a professional site, or whether you are a master or a cainiao, the JavaScript library is becoming more and more powerful, I can do a lot of
Xmlns = "http://www.w3.org/1999/xhtml">
Name
Age
Position
Income
Gender
John
37
Managing director
90.000
Male
Susan
34
Partner
90.000
Female
David
29
Head of
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.