Example 1,replace with variable
The Replace function can use regular expressions to match string implementation substitutions.
The problem encountered today is that the regular expression has a variable, taking today's actual situation as an
Today, a project needs to determine the IE version number, and because JQuery 2.0 to remove the browser version number of the judge (it recommended feature detection), so I saw a foreigner wrote a piece of code:
The code is as follows
In the JS code, because of the differences in behavior between browsers, we often include a large number of if statements in the function to check browser features to resolve compatibility issues with different browsers. For example, our most common
In the Web front-end development process, we often need to change this point, usually we think of the call method, but for call understanding many people are not very clear, then the following small series to give you a detailed talk of call and
Check Chinese characters
The code is as follows
Copy Code
function Chkstrlen (str){var strlen = 0;for (var i = 0;i {if (Str.charcodeat (i) > 255)//If it is Chinese, the string length plus 2Strlen + 2;Elsestrlen++;}return
JS Way to read JSON I have two kinds of contacts:
Method One: Function construction definition method returns
The code is as follows
Copy Code
var Strjson = "{name: ' JSON name '}";//Get JSONvar obj = new Function
JavaScript dynamically load JS script1, Direct document.write
The code is as follows
Copy Code
");
2, dynamically changing the SRC attribute of the existing script
The code is as follows
Copy
ReadOnly and disabled are two properties that are used in a form to make it impossible for users to change the contents of a form field. But there is a slight difference between them, summed up as follows:
ReadOnly is only valid for input
Screen ObjectThe Screen object contains information about the client's display screens, not the exposed standards that are applied to it, although all browsers support the object, and the screen property of each Window object refers to one.
Screen
Location objectsThe Location object contains information about the current URL, a part of the Window object that can be accessed through the Window.location property
Location Object Properties
The href property is a readable, writable string that
Example: The effect we want to achieve is to append some new data to the old data when the user clicks the mouse.If you use the standard DOM, the complete code is as follows:Copy code code as follows:
test
data
The code is as follows
Copy Code
JavaScript files
The code is as follows
Copy Code
Initialize pagefunction init () {var ary = Jsontoarray (XMLReader ("Node", "Content.dibi"));var Divtoc =
This article is a simple function Oh, if you are JS beginners can look at this code OH.
Here is the HTML code
User name:"*Password"*Password to be lost again:"*Personality Signature:Mailbox"
Tip: you can modify some code before running Delete repeated items in select Demo of deleting select repeated itemsHttp://www.111cn.net/ Waiting for initialization... Initialization Delete duplicate items Tip: you can modify some code
Tip: you can modify some code before running 与之间-->与之间--> _ × Www.111cn.net Chinese webmaster sky, webmaster Site Park Tip: you can modify some code before running
Tip: you can modify some code before running Javascript cool, concise, and beautiful paging effectJavascript cool, concise, and beautiful paging effect与之间-->与之间-->Paging: (100 records in total, 10 pages, 0th pages currently) & laquo; 1 )? ParseInt
Tip: you can modify some code before running JavaScript color gradient and gradient effectJavaScript color gradient and gradient effectColor gradient change demonstration: Simple color picker (click to modify the gradient demo color ): Color
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