The first type: JS timed automatically close the window
The code is as follows
Copy Code
The second: Click the link does not prompt JS close the window
The code is as follows
Copy Code
Let's say there's a checkbox named CheckBox1 on the Web page with a form,form named Form1.
The code is as follows
Copy Code
var f = document.form1;var sum=0;if (f.checkbox1.length) {for (var i=0;i if
Example
The code is as follows
Copy Code
function Getrepeatdata (input) { var arr = input; var rdata = {}; for (var i in arr) { &nbs p; var c = arr[i]; rdata1? (rdata1++): (rdata1= 1) } for
1. Keys to raise events
Non-character keys do not raise KeyPress events, but non-word keys can raise KeyDown and KeyUp events. The KeyPress event Keychar property can get the characters entered.
2. Time caused by the event
The KeyDown and
Review Object Oriented knowledge:
What is a wrapper object?
The base type has its own corresponding wrapper object String number Boolean Array Data
String is not an object why does it have a method?
Solution: Methods are hung under the prototype
Recently ready to do a mobile phone side of the site. So on the internet to find a few to determine whether it is a mobile phone browser JS script, posted up, share under:
1. How to determine whether to use the regular match for mobile terminals,
Declaration of variables
JavaScript uses keyword var to declare a variable, you can declare it after it is assigned, or you can assign a value at the same time as a declaration, and multiple variables declare commas (,) delimited. For example:
In the electronic business of recharge, payment and other actions; After the user confirms the order, executes the submission action, we call this page "the Order submits the page", the order opens a new page jumps to the payment platform to carry
The Window.settimeout method is used to delay the execution of a segment function (method). But it is in a certain defect when calling the specified method and passing the parameter. General direct reference, can only pass the parameters such as
Just as a string literal is defined as a character enclosed in quotation marks, the regular expression literal is also defined as a character that is contained between a pair of slashes (/). Therefore, JavaScript may contain the following code:
For example, date 1 is 2009-8-1, date 2 is 2009-7-1.
Using the Split function to slice,
Method 1
The code is as follows
Copy Code
Method 2
JS Date comparison (YYYY-MM-DD)
The code is as follows
The code is as follows
Copy Code
1, read the XML file through JS, the main is to judge each browser View Code Load XML documentvar loadxml = function (xmlFile) {var xmldoc;if (window. ActiveXObject) {xmldoc = new ActiveXObject ('
JavaScript does not have any built-in formatting functions, and here we've collected 5 JavaScript number format functions via Google, which we hope will bring convenience to all of our web development.
Decimal rounding
These two pieces of code
SOURCE ExampleOne: The JavaScript page automatically submits the form when it is trimmedForm form:
The code is as follows
Copy Code
JavaScript code:
Note: When submitting a form using JavaScript, do not use id=
This article provides you with several commonly used JavaScript tutorials e-mail Verification code Oh, all are streamlined and easy to understand the JS email verification program Oh, let's look at these examples.
I. BackgroundIn some scenarios, functions may be called frequently, and these functions occupy a large amount of memory or computing, which may cause high performance problems. For example:Window. onresize event. The window. onresize event is
Blob indicates binary raw data. A Blob object is a class file object containing read-only raw data.APIs that inherit Blob functions include:File object: processes binary data that exists in the File form, that is, operations on local files;FileList
Tip: you can modify some code before running Javascript + DIV movable floating layer codeCreate a window for DIV to float on the pageThis code is provided by the webpage special effect network. Tip: you can modify some code before running
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