JavaScript Common Functions List

Source: Internet
Author: User
Tags date object functions join string split variable window
JavaScript is a list of commonly used functions to facilitate their own inquiries.

The click () object. Click () to cause the object to be clicked.
Closed object. Closed Object window is closed True/false
Cleartimeout (object) clears the SetTimeout object that has been set
Clearinterval (object) clears the SetInterval object that has been set
Confirm ("Hint info") Pop-up confirmation box, OK return true cancel return False
Cursor: Style change mouse style hand crosshair text wait help default auto E/s/w/n-resize
Event.clientx return to the last click of the mouse X coordinate value;
Event.clienty return to the last click of the mouse y coordinate value;
EVENT.OFFSETX returns the current mouse hover x coordinate value
Event.offsety returns the current mouse hover y-coordinate value
document.write (document.lastmodified) page last update time
Document.ondblclick=x when you double-click the mouse to produce an event
Document.onmousedown=x Click mouse button to generate event
Document.body.scrollTop; Returns and sets the coordinate value of the current vertical scroll bar, which must match the function,
Document.body.scrollLeft; Returns and sets the coordinate value of the current horizontal scroll, which must be matched with the function,
Document.title document.title= "message"; Title bar text for the current window
Document.bgcolor document.bgcolor= "color value"; Change window background color
Document. Fgcolor document.   fgcolor= "color value"; Change body Color
Document.linkcolor document.linkcolor= "color value"; Change the color of the super join
Document.alinkcolor document.alinkcolor= "color value"; Change the color of the join being clicked
Document. Vlinkcolor document.   vlinkcolor= "color value"; Change the color of an access join
Document.forms.length returns the current page form form singular
Document.anchors.length returns the number of current page anchors
Document.links.length returns the number of current page joins
Document.onmousedown=x mouse click to trigger Event
Document.ondblclick=x double click to trigger Event
Defaultstatus Window.status=defaultstatus; Set the status bar to the default display
function function xx () {...} Defining functions
IsNumeric judge whether it is a number
InnerHTML xx= object. InnerHTML Enter the HTML source code in the tag of an object
InnerText Divid.innertext=xx will set the object value named with Div to ID to xx
Location.reload (); To refresh this page, target can be equal to a refreshed page
Math.random () The number of random culvert, can only be between 0 to 1, if you want to get the other number, can be *10, and then rounding
Math.floor (number) converts the number of objects to integers, taking all decimals
Math.min (1,2) return to 1,2 which small
Math.max (1,2) return to 1,2 which big
Navigator.appname returns the current browser name
Navigator.appversion returns the current browser version number
Navigator.appcodename returns the current browser code name
Navigator.useragent returns the current browser user token
OnSubmit onsubmit= "return (XX ()") using the function returned value
Opener Opener.document. Object control original Open Form object
Prompt xx=window.prompt ("hint info", "predetermined value"); Input statement
Parent parent. Frame name. Object Control frames page
Return returned false returns a value
Random random parameters (between 0 and 1)
Reset () Form.reset (); Reset the data in form forms
Split ("") String.Split ("") separates string object characters specifier commas
Submit () Form object. Submit () Submit the Form object to the data
The CharAt (x) object of a String object returns the letter of the number of digits in the specified object
LastIndexOf ("string") from right to left to find the specified character, does not return-1
IndexOf ("string") polls for the specified character from left to right, not returning-1
lowercase () converts objects to lowercase
Uppercase () to capitalize all objects
SUBSTRING (0,5) string.substring (x,x) returns characters from 0 to 5 in the object
SetTimeout ("function", time) sets a timeout object
SetInterval ("function", time) sets a timeout object
toLocaleString () x.tolocalestring () Gets the time from the X-time object as a string type
typeof (variable name) Check the type of variable, the value is: string,boolean,object,function,underfined
WINDOW.EVENT.BUTTON==1/2/3 the left key of the mouse button equals 1 right key equals 22 keys together press 3
Window.screen.availWidth returns the current screen width (blank space)
Window.screen.availHeight returns the current screen height (blank space)
Window.screen.width returns the current screen width (resolution value)
Window.screen.height returns the current screen height (resolution value)
Window.document.body.offsetHeight; Returns the height of the current page
Window.document.body.offsetWidth; Returns the current page width
Window.resizeto (0,0) sets the window to a wide height
Window.moveto (0,0) moves the window to a location
Window.focus () to get focus on the current window
Window.Scroll (x,y) window scroll bar coordinates, y control moves up and down, must match the function
window.open ()
window.open ("Address", "name", "property")
Properties: Toolbar (Toolbar), location (address bar), Directions,status (status bar),
MenuBar (menu bar), scrollbar (scroll bar), resizable (change size), Width (width), height (high), fullscreen (full
screen, scrollbars (no scroll bar without parameters in full screen, Channelmode (widescreen), left (open window x coordinates), Top (open window y-coordinate)
window.location = ' View-source: ' + window.location.href Application Event View Web page source code;
A=new Date (); Create a for a new period object
Y=a.getyear (); The value of Y is a two-digit year of the year value obtained from Object a
Y1=a.getfullyear (); Get four-digit years of the year
M=a.getmonth (); Get month value
D=a.getdate (); Get Date value
D1=a.getday (); Get Current Week value
H=a.gethours (); Get the current number of hours
M1=a.getminutes (); Get the current number of minutes
S=a.getseconds (); Get the current number of seconds
object. style.fontsize= "Text Size";
Unit: mm/cm/in inch/pc/pt point/px pixel/em text height
1in=1.25cm
1pc=12pt
1PT=1.2PX (800*600 resolution)
Text Font properties:
FontSize size
Family fonts
Color colors
FontStyle style, take the value of normal, italic italic, oblique italic and bold
FontWeight bold, with values ranging from 100 to 900, 900 thickest, light,normal,bold
letterspacing spacing, changing the distance between the text, taking the value of, 1pt,10px,1cm
TextDecoration: text decoration; value, none not decorated, underline underline, overline underlined
Background: Text background color,
BackgroundImage: Background picture, take value as the insert path of the picture
Click the page body function to invoke the trigger:
1.onClick when the object is clicked
2.onLoad when the page is open, it can only be written in the body
3.onUnload when the page is closed or left, it can only be written in the body
4.onmouseover when the mouse hovers over it
5.onmouseout when the mouse leaves the object
6.onmouseup when the mouse is released
7.onmousedown when the mouse presses the key
8.onFocus when the object gets focus
9.onSelect when the text of the object is selected
10.onChange when the contents of the object are changed
11.onBlur when the object loses focus
Value returned when Onsubmit=return (SS ()) Table is monotonic
Straight border-bottom:1x solid Black
Dashed border-bottom:1x dotted black
Dot Dash border-bottom:2x dashed black
Double black with two-line border-bottom:5x
Groove-shaped border-bottom:1x groove Black
Ridge-shaped border-bottom:1x Ridge Black
1. Edge High Light Glow (color= color, strength= brightness size)

Web page automatically set as home page
Under the previous title of the cookie function that defines the preceding javascript:
Add in the back

Onmouseover= "If" (!this.ishomepage (' http://www.mydomain.com/')
&&
window.external &&! GetCookie (' homepage '))

{
This.sethomepage (' http://www.mydomain.com/');
Setcookie (' homepage ', ' true ');
}
return false; >

Related Article

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.