Instance code:Copy codeThe Code is as follows: 1 2 3 4 5 6 Effect: 1 2 3 4 5 6 [Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]For details about the instance code, see:Copy codeThe
Dynamic Construction of Regular Expressions
Copy codeThe Code is as follows:New RegExp (Expr. match [type]. source + (/(?! [^ \ [] * \]) (?! [^ \ (] * \)/. Source ))This avoids character escaping when a regular expression is dynamically constructed
I really don't want to review software engineering at night. Write a player. This is just a small Demo for learning. For many imperfections, the source code is posted below. If you want to reprint it, add a copyright statement.PS: Because Ajax
We have tested the performance of common jQuery methods and their equivalent native methods (1, 2, 3 ).I know what you're thinking. The native method is obviously faster than the jQuery method, because the jQuery method must handle browser
I wrote a waterfall stream by myself. My personal habit of writing scripts or webpages is: I only refer to others' effects and seldom refer to others' codes, sometimes I prefer to use the review element to deduce the Code, rather than look at the
Alert (3)In this case, the program is not written in the function. I wonder, how can I end JavaScript?Alert (3)Return;Alert (3)If this write fails, return can only terminate the function.I cannot find a solution on the Internet. Ask a friend. I can
There is only one small area on the webpage, but the descriptive text is very long. The following script displays the long text.When a user clicks expand, the text is expanded, and the text is merged.Originally, you can write with the toggle () that
JS judgment can only be a number or a decimal point0. Chinese characters cannot be entered1) 2)
1. Only numeric code can be entered in the text box (decimal point cannot be entered)2. Only numbers can be entered, and decimal points can be entered.3.
You can smoothly scroll to the specified position of the page without using an anchor.Copy codeThe Code is as follows: ScrollTo: Scroll smoothly to the specified position on the page ScrollTo: Scroll smoothly to the specified position on the page
If you do not want to download and store jQuery, you can also reference it through CDN.Google and Microsoft servers both have jQuery.To reference jQuery from Google or Microsoft, use one of the following code:Google CDN:Copy codeThe Code is as
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
Copy codeThe Code is as follows:/*1. obj is equivalent to window2. type is equivalent to onload3. fn is equivalent to an anonymous Function*/Function addEvent (obj, type, fn ){Var saved = null; // The user saves the previous eventIf (typeof obj ["on"
The. children (selector) method returnsAll child elements(Son generation only). Optional. Add parameters to filter elements by selector.
The. find (selector) method returnsDescendant.Parameters are requiredThe selector and jquery object can be used
For example, we want a recursive function to calculate the Fibonacci series. A Fibonacci number is the sum of the first two. The first two digits are 0 and 1.Copy codeThe Code is as follows:Var maid = function (n ){Return n };For (var I = 0; I
In terms of flexibility, we have considered many aspects and provided several important configurations for ease of use in various environments. You are welcome to use shoes and the source code is fully open. The reason for developing this plug-in is
Scope is one of the most important concepts of JavaScript. To learn JavaScript well, you need to understand the working principles of JavaScript scopes and scope chains. This article briefly introduces the JavaScript scope and scope chain, hoping to
4.1 manually create an instanceCopy codeThe Code is as follows: 4.1. Create an instance manually. The test shows that if modal is set to true, the mode window is used, that is, when the background is masked, draggable: true dragging is invalid.5.1
The parameter descriptions of the callback function are also accurate:The first parameter is the matched string, the last parameter is the original string, and the last parameter is the start position of the matched string index.But I'm curious,
I. SyntaxThe expression after delete must be referenced by an attribute, for exampleVar o = {a: 1 };Delete o. a; // here, o. a is a reference to attribute a of object o.A separate attribute name can be used only in the with statement.Copy codeThe
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