Let's take a look at the regular rules.
Text
/^ (\d+) $/corresponds to "pure digits"/^ ([a-za-z]+) $/corresponds to "pure letter"/^ ([a-za-z].+) $/corresponds to "beginning of letter + any character"/^ ([0-9a-za-z]+) $/corresponds to "number +
One: ability detection (characteristic detection)
Ability detection is not the ability to identify a particular browser, but to identify the browser.
Two: Eccentricity detection
Unlike the ability to detect, it is mainly to identify browser bugs,
1 Factory mode:The factory model is a well-known design pattern in software engineering, which abstracts the process of creating concrete objects. Because ECMAScript cannot create a class, developers invent a function that encapsulates the details
Process Control statements are critical in JS. The Process Control statements in JS include 7 kinds of statements, such as if condition judgment statement, for Loop statement, while Loop statement, Do......while Loop statement, break statement,
Example 1
The code is as follows
Copy Code
/**Determine the date format entered in the input box is YYYY-MM-DD and the correct date*/function IsDate (sm,mystring) {var reg =/^ (d{4})-(D{2})-(d{2}) $/;var str =
Use JS to get the value of the two-digit input box on the page and compare it to size. The result may be confusing to you, such as code:
The code is as follows
Copy Code
var v1 = $ (' #input1 '). Val ();var v2 = $ ('
There are two types of ECMAScript integers, that is, signed integers (allowed with positive and negative numbers) and unsigned integers (only positive numbers are allowed). In ECMAScript, all integer literals by default are signed integers, what
Here's a relatively simple way to realize this: a container demo that sets the width and hides content that extends beyond its width, where demo1 and demo2,demo1 are scrolling content, Demo2 for Demo1 direct cloning, By constantly changing the demo1
1. Length Limit
The code is as follows
Copy Code
2. Can only be Chinese characters
The code is as follows
Copy Code
3. can only be English
The code is as
JavaScript shows time, time is still moving! Not a static effect!
Functions time () defines a function.
{if (!document.layers&&!document.all)
Return because IE differs from Netscape's interpretation of JavaScript, which results in different browsing
Parameters:(1) objNecessary. The name of the variable to which the Object object is assigned.(2) valueOptional. Any of the JavaScript primitive data types (numbers, Boolean values, or strings). If the value is an object, the returned object is
First, the function realizes the core: FileSystemObject object
To implement the file manipulation function in JavaScript, the main thing is to rely on the FileSystemObject object.
Second, FileSystemObject programming
Programming with a
The examples in this article describe the way in which JavaScript implements thousands of decimal points. Share to everyone for your reference, specific as follows:
Although there are two months to go before the new year, the Battle of the Spring
JavaScript supports regular expressions by regexp classes, for the simplest example:
Copy Code code as follows:
var regapple = new RegExp ("Apple");
It can match the first "Apple" string that appears in a string, and is
JS Self-band function
Concat
Combines the text of two or more characters to return a new string.
var a = "Hello";
var B = ", World";
var C = A.concat (b);
alert (c);
c = "Hello,world"
IndexOf
Returns the index (search from left to
getFullYear ()use getFullYear () to get the year.Source:
click the button to display the full Year of todays date.
try it
function MyFunction ()
{
var d = new Date ();
var x = document.getElementById ("demo");
X.innerhtml=d.getfullyear (
Scopes and closures? scopeEngine: Responsible for the entire JavaScript compilation and execution process from beginning to end.Compiler: Responsible for parsing and code generation.Scope: Collects and maintains a series of queries consisting of all
How does js determine whether it is in iframe and prevent webpages from being embedded with iframe and iframe nesting?
1. How does js determine whether it is in iframe?
Js Code
// Method 1 if (self. frameElement & self. frameElement. tagName =
Tip: you can modify some code before running Javascript imitation window multi-window desktop effect (with simulated alert () Prompts. And confirm ())Window type 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