1. Use the built-in random number occurrence method:
Copy Code code as follows:
Math.random (); This method produces a floating-point number between 0 and 1.
Math.floor (Math.random () *10+1); 1-10
Math.floor (Math.random () *24);/
See the input frame of a website to support the function of screen pasting, feel a little meaning, so the code out to share.
Unfortunately, only a high version of the Chrome browser to support this direct paste, other browsers so far have not been
(i) Dynamic selection methods and properties
In practice, we often encounter situations where we invoke one of the two methods [1] According to a certain condition, or read and write on one of the two properties [2]. The following code shows this
This article summarizes the commonly used JavaScript pop-up window method for everyone to compare the reference, hope to be helpful to everyone. Detailed methods are as follows:
1. No prompts to refresh the page:
We have not found that some pages,
JavaScript implementation of square meters, mu, ha unit conversion, you can pass the parameters of the URL to specify the value of the input box is the value of any unit.
The source code is as follows:
javascript the implementation of
Saying today is just a cursory glance at the source of proxy switchysharp, it has harvested a lot of things, including this article to introduce the reading and saving files.Because Google does not yet provide the ability to sync plug-in data,
The way to add JavaScript code to the client is to place it in the pseudo protocol descriptor javascript: the URL that follows. This particular protocol type declares that the principal of the URL is any JavaScript code, which is run by the
Find a lot of trees on the internet to achieve, the total feeling is not satisfactory, not the need to reference JS external files using Plug-ins, is the code too much to see the dizzy, in fact, I just want to implement a simple code, logic is not
Copy Code code as follows:
/* Gets the timestamp of the start of the render, stored in the array page_speed_time.
......
Copy Code code as follows:
......
/* At the end of the page, calculate the time to load
One, the realization clicks the button, duplicates the content in the text box
user-defined code area
Second, copy the topic address and URL address, passed to qq/msn friend
js Copy code
Third, direct copy URL
1. Only allow numbers to be entered
2, only allowed to enter English letters, numbers and underscores (the following two ways to achieve)
3, only allowed to enter English letters, numbers and =@#
4, only
Last time I got a web APP for my website based on the tutorials on the web, but it was very bad for the users.
Problem Description:
What's wrong? It turns out that when you open the Web app and open the connection on the home page, you'll open the
Recently has been studying DEDECMS, ready to build the station, has been in the want to use without pseudo static, to now have not decided to come down, think about it, the best way to look at the same type of Web site is static or pseudo static.
Background
There are several minor problems with AddEventListener () or attachevent () binding events in javascript:
An anonymous function added with AddEventListener () or attachevent () cannot be removed.
Copy Code code as follows:
The most basic function of JavaScript in a Web page is to listen to or respond to a user's actions, which is very useful. The user's action some very high frequency, some very rare. Some listener functions execute like lightning, and some heavy drag
JavaScript gets CSS property value method: getComputedStyle and Currentstyle1. For the inline CSS style of the element (hello), you can directly use Element.style.color to get the value of the CSS property directly;2. However, external-defined CSS
Copy Code code as follows:
function Dealnull (obj) {
for (var i in obj) {
if (null = = Obj[i] | | ' null ' = = Obj[i]) {
Obj[i]= ';
}else if (' object ' = = typeof Obj[i]) {
Dealnull (Obj[i]);
}
}
};
The object of the test
var a={};
Use regular expressions to remove all punctuation in a string
Copy Code code as follows:
Extracting HTML Chinese text with regular expressions
Copy Code code as follows:
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