Recently developed projects need to read the values of the parameters in the URL string with JavaScript
Through the search of information and their own experiments, finally succeeded
The script is as follows:
Copy Code code as follows:
1.indexOf and LastIndexOf methods:
Because IE7 uses indexof on an array object, it will be an error, so you need to override a compatibility.
Copy Code code as follows:
Array.prototype.lastIndexOf (Item,index) {
var n =
variable scope problem in JS :
1, there is no block-level scope. The variable scope in JS is not bounded by {}, unlike C/c++/java.
Such as:
Copy Code code as follows:
if (true) {
var name = "Qqyumidi";
}
alert (name); Result:
Copy Code code as follows:
Date Input
Put the input of YYYY.MM.DD, YYYY. Mm. DD, YYYYMMDD to Yyyy-mm-dd
Checkdt This function was found in the Niang.
Very simple and practical functions, the small partners can be
Make a note.
Copy Code code as follows:
Disable right-click menu, Copy, select
$ (document). Bind ("ContextMenu copy Selectstart", function () {
return false;
});
Disable CTRL + C and CTRL + V (supported by all browsers)
$
Code is very simple, just give everyone a train of thought, here is not much nonsense, the source code:
Copy Code code as follows:
micro-letter JS API demo
Here is just the introduction of ideas to
This article illustrates the coexistence of both click and double-click for JavaScript implementation. Share to everyone for your reference. The specific analysis is as follows:
In our web development process, we often encounter such a problem, for
The code is super simple, here is no more nonsense, small friends to see their own notes,
The code:
Copy Code code as follows:
is not very practical, small partners according to their own needs to use it.
First, form validation form
1. Create a new form:
Copy Code code as follows:
Method 1:post no length limit after submission, and the content is not visible after encoding.
Method 2:get commits a length limit, and the encoded
The specific explanation is in the annotation, here is not much nonsense, directly to the code
Copy Code code as follows:
The common mobile Terminal browser version is basically here, there is a need for small partners under the
Before using JavaScript, you will occasionally encounter the use of = = and = = Two symbols to determine whether two variables are equal. But the difference between the two symbols has not been investigated. Today I met the symbol = = =, so I
Organize the JS object-oriented encapsulation and inheritance.
1. PackageJS is packaged in a number of ways to implement, here are listed in several commonly used.
1.1 Raw Pattern Generation objectsWrite our members directly into the object and
Code is very simple, I do not have much nonsense here, directly to the source code:
Copy Code code as follows:
String path = Request.getcontextpath ();
String basepath = request.getscheme () + "://" +request.getservername () + ":"
The examples in this article describe custom event usage in JavaScript. Share to everyone for your reference. The specific analysis is as follows:
In the Web front-end development, many people may not use JS custom events, but if it is to do a
Copy Code code as follows:
The code is very simple, the function is very practical, the small partner beautification can use to own project, is not very cool
The examples in this article describe the way JavaScript defines classes and objects. Share to everyone for your reference. The specific methods are as follows:
In JS, classes and objects have a variety of different ways of writing, because I am
This paper illustrates the method of the original JavaScript to realize the delay loading of the picture. Picture delay loading is actually a jquery plugin and the loading method is very simple and reasonable, but some friends feel that the load
I. Two prototypes
Many people know that JavaScript is a prototype inheritance, each constructor has a prototype member, through which the JavaScript can inherit the magnificent.Actually, this one attribute is not able to complete the JavaScript
The code is very simple, mainly to provide you with a way of thinking, but also learning JavaScript for so long a small practicing.
Chained programming is the use of multiple operations (multiple lines of code) through the dot number "." Link
For very large or very small numbers, floating-point values can be represented by scientific notation. Using scientific notation, a number can be expressed as a number plus e/e, followed by a multiple of 10, such as:
Copy Code code as
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