Definitions and usageThe NodeType property returns the node type of the selected node.
Grammar:Elementnode.nodetype
Node Number:
node Name:
1
Element
2
Attribute
3
Text
4
Copy Code code as follows:
If you want to take two copies of the month and day, you have to make your own judgment for processing, such as:
Copy Code code as follows:
JS Code
Copy Code code as follows:
/**
* Get start date, stop date for this week, this quarter, this month, last month
*/
var now = new Date (); Current date
var nowdayofweek = Now.getday (); The first day of this week
var nowday =
The typeof in JavaScript is actually very complex, it can be used to do a lot of things, but at the same time there are a lot of weird performance. This article enumerates several usages of it, and also points out the existing problems and solutions.
This menu effect is controlled by scripts and styles and is a great learning element for beginners:
This night while watching the dance miracle, while finishing the small code of this menu, a look at it, will be able to restudying, can not learn
Achieve 1
Copy Code code as follows:
String.prototype.trim = function () {
Return This.replace (/^\s\s*/, '). Replace (/\s\s*$/, ");
}
It does not look very good, using two of regular replacements, the actual speed is
Do the accordion effect as follows, specific look at the code:HTML code
Copy Code code as follows:
Accordion
level one
first item
second item
third item
level one
first item
second item
third item
Copy Code code as follows:
Determining whether to run the environment for the mobile end
if (/applewebkit.*mobile/i.test (navigator.useragent) | | (/midp| symbianos| nokia| Samsung| Lg| nec| tcl| alcatel| bird| dbtel| dopod| philips| haier|
toLocaleUpperCase method
Returns a string in which all alphabetic characters are converted to uppercase and are adapted to the host environment's current locale.Stringvar.tolocaleuppercase ()The required stringvar reference is a String object,
For example:
JSON string:var str1 = ' {' name ': ' cxh ', ' sex ': ' Man '} ';JSON object:var str2 = {"Name": "Cxh", "Sex": "Man"};
One, JSON string converted to JSON object
To use the above str1, you must first convert to a JSON object by using
Copy Code code as follows:
to validate a regular expression set of numbers
Verify Number: ^[0-9]*$
Verify the N-bit number: ^\d{n}$
Verify at least n digits: ^\d{n,}$
Verify the number of m-n bits: ^\d{m,n}$
Verify numbers
An Image object that does not appear in the document
Defined with the Var statement for an Image object that is not displayed in the document:
Copy Code code as follows:
var myimage = new Image ();
var myimage = new Image ();
General Event Event Browser support description
OnClick ie3| n2| O3 Mouse click events, multiple mouse clicks within a controlled range of an object
OnDblClick ie4| n4| O Mouse Double-click event
OnMouseDown ie4| n4| O the button on the mouse is
According to the ID number to identify the age of sex birthday JS code:
Copy Code code as follows:
function Discricard () {
Get input ID number
var uusercard = "";
Get Date of birth
Uusercard.substring (6) + "-" + uusercard.substring
In the JS logical operation, 0, "", null, False, undefined, Nan all are judged to be false, others are true.|| Calculates the first operand and, if it can be converted to true, returns the value of the expression on the left, otherwise the second
Suppose we have a container container as follows:
Copy Code code as follows:
Now you have to pop a div layer on the Web page so that you can't manipulate container before you close the div layer that pops up.
So,
Copy Code code as follows:
2) {this.value=this.value.split ('. ') [0]+ '.] +this.value.split ('. ') [1]} " >
1. Text box can only enter a numeric code (decimal point can not enter)
Copy Code code as follows:
First look at a function of JS
JavaScript eval () function
Definitions and usage
The eval () function computes a string and executes the JavaScript code in it.
Grammar
Eval (String)
Parameter description
String required. The string to evaluate,
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