JavaScript script code (c) 20140926

Source: Internet
Author: User

One, form verification:
1. Non-null verification (go blank)
2. Contrast verification: compare with a value
3. Scope Validation: Judging by a range
4. Fixed format test: email, phone number, ID number, postal code, credit card number
5. Other Verification:

Regular expressions: Using symbols to describe writing rules

Grammatical form: var a =/the contents of the regular expression;
^: Match opening/^love$/very love Lovelove
$: Match End
\d: An arbitrary number/^\d\d\d\d\d\d$/
\w: An arbitrary number or letter
{n}: Put the expression on the left, repeat N-Times/^\d{6}$/
{M,n}: Put the expression on the left, repeat at least m times, at most n times
{m,}: The expression on the left is repeated at least M-times, at most
+: The left expression appears at least once, at most, equal to {1,}
*: Left expression, at least 0 times, at most, equivalent to {0,}
?: Left expression, at least 0 times, up to 1 times, equivalent to {0,1}
[A,c,d]; only one of the contents in square brackets can be taken
[A-z] or [a-z] or [0-9]: Take one of the ranges
|: OR
(): Priority
\: Escaped

((\ (\d{3,4}\)) | (\d{3,4}[-]))? \d{7,8}
(0533) 3434567
Second, date time operation
var d = new Date (); Current time
var d = new Date (1999,3,2); 1999-4-2

getFullYear ()
GetMonth ()
GetDate ()
GetDay ()
GetHours ()
Getminutes ()
Getseconds ()


Third, mathematical function operation
Math.ceil ();
Math.floor ();
Math.sqrt ();
Math.Round ();
Math.random ();

Iv. Events
Event three elements: Event source, event data, event handler
Event bubbling: When an element is nested at a time, by default, an inner element fires an event, and the corresponding event of the outer element is then triggered in turn.
onclick--Click Trigger
ondblclick--Double-click Trigger
onmouseover--Mouse Move Up trigger
onmouseout--triggers when the mouse leaves
onmousemove--Mouse on the top move less
Trigger when onblur--loses focus
Trigger when onfocus--gets focus
onchange--after the content has changed, trigger

OnKeyDown
onkeyup--trigger when the button is lifted.
onkeypress

JavaScript script code (c) 20140926

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.