JS DOM Manipulation function event

Source: Internet
Author: User
Tags mathematical functions

a function

1. String functions

S.tolowercase ();---Variable lowercase

S.touppercase ();---Variable capitalization

S.SUBSTR (2, 8);--intercept starts at index 2, intercepts 8 character lengths

S.split ();--Specifies the character split, returning an array. Put a character in parentheses, divide s by this character

s.length;--length

S.indexof (); --The first occurrence in the string, looking for an index, no return-1.

S.lastindextof (); --Find the first matching index from the back.

2. Time-Date function

var d = Now Date (); --current time, access to the user's computer system time (prone to problems)

var d = Now Date (1999,3,2)-Defines the time, April 2, 1999.

--Define the month minus one.

Get

D.getfullyeat (); --Take the year

D.getmonth ();--Take the month, which is 1 less than the actual month.

D.getdate (); --Take the day

D.getday (); --Take the day of the week

D.gethours (); --Take hours

D.getminutes (); --Take minutes

D.getseconds (); --Take seconds

Set up

D.setfullyear (); --Set year

D.setmonth ();---set the month in the setting is time to note plus 1.

...........

3. Mathematical functions

Math.ceil (); --Take the upper limit

Math.floor (); --Take the lower limit

Math.Round (); --Rounding

Math.random (); --random number, between 0--1

var v = math.random ();

Math.ceil (V*10); --Take 1--10 random number

A. Match (b)--determine if the match

--String A, B to match, if not match returns null

--just determine if the content matches, not the data type.

--"= = =" Three equal signs indicate identity, content type, etc. are equal.

JS DOM Manipulation function event

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.