List of common JavaScript Functions-click, location, scroll and confirm

Source: Internet
Author: User

Examples of common JavaScript Functions-click, location, scroll, and confirm are provided in www.bkjia.com. The following content is collected on the Internet:
Click () object. click () enables the object to be clicked.
Whether the closed object window has been closed; true/false
ClearTimeout (object) clears the set setTimeout object
ClearInterval (object) clears the set setInterval object
The confirm ("prompt message") dialog box is displayed. confirm to return true. Cancel to return false.
Cursor: style change mouse style hand crosshair text wait help default auto e/s/w/n-resize
Event. clientX returns the X coordinate value of the last mouse clicked;
Event. clientY returns the last mouse Y coordinate value;
Event. offsetX returns the X coordinate value of the current mouse hover.
Event. offsetY returns the Y coordinate value of the current mouse hover.
Document. write (document. lastModified) Last Update Time of the webpage
Document. ondblclick = x: an event occurs when you double-click the mouse.
Document. onmousedown = x click the mouse key to generate an event
Document. body. scrollTop; returns and sets the coordinate value of the current vertical scroll bar, which must be used with the function,
Document. body. scrollLeft; returns and sets the coordinate value of the current Horizontal Rolling task, which must be used with the function,
Document. title document. title = "message"; title bar Text of the current window
Document. bgcolor document. bgcolor = "color value"; change the background color of the window.
Document. Fgcolor document. Fgcolor = "color value"; change the body color
Document. linkcolor document. linkcolor = "color value"; change the superjoin color.
Document. alinkcolor document. alinkcolor = "color value"; change the color of the click link.
Document. VlinkColor document. VlinkColor = "color value"; change the color of the accessed Link
Document. forms. length returns the number of form forms on the current page
Document. anchors. length returns the number of anchors on the current page.
Document. links. length returns the number of connections on the current page.
Document. onmousedown = x click the mouse to trigger the event
Document. ondblclick = x double-click mouse trigger event
DefaultStatus window. status = defaultStatus; set the status bar to display by default
Function xx () {...} defines a function
IsNumeric determines whether it is a number
InnerHTML xx = object. innerHTML: Enter the html source code in an object tag.
InnerText divid. innerText = xx
Location. reload (); refresh the current page. The target can be equal to a refreshed webpage.
Math. random () random Han number, which can only be a number between 0 and 1. To get another number, it can be * 10 and then rounded up.
Math. floor (number) converts the object number into an integer and returns all decimals.
Which of the following values is returned for Math. min (1, 2 )?
Which of the following values is returned for Math. max (1, 2 )?
Navigator. appName: returns the name of the current browser.
Navigator. appVersion: returns the current browser version.
Navigator. appCodeName: returns the name of the current browser code.
Navigator. userAgent returns the user ID of the current Browser
Onsubmit = "return (xx ()" use function return value
Opener opener.doc ument. Object Control Original open form object
Prompt xx = window. prompt ("prompt message", "pre-value"); input statement
Parent. Framework name. Object Control Framework page
Return false return value
Random parameter (between 0 and 1)
Reset () form. reset (); reset the data in the form
Split ("") string. split ("") Separate string object characters with commas
Submit () form object. submit () enables the form object to submit data
The charAt (x) object of the String object returns the nth Letter of the specified object.
LastIndexOf ("string") searches for the specified character from right to left.-1 is not returned.
IndexOf ("string"): query the specified character from left to right.-1 is not returned.
LowerCase () converts all objects to LowerCase letters
UpperCase () converts all objects to UpperCase
Substring () string. substring (x, x) returns the 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 () obtains the time from the x time object, which exists as a string.
Typeof (variable name) checks the type of the variable. The values include String, Boolean, Object, Function, and Underfined.
Window. event. button = 1/2/3 left mouse button equals 1 right button equals 2 press 3 together
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.doc ument. body. offsetHeight; returns the current webpage height.
Specified parameter Doc ument. body. offsetWidth; returns the current webpage width.
Window. resizeTo () set the window width and height
Window. moveTo (0, 0) Move the window to a certain position
Window. focus () to make the current window focus
Window. scroll (x, y) coordinates of the window scroll bar. y controls the up and down movement and must work with functions.
Window. open ()
Window. open ("Address", "name", "attribute ")
Attributes: toolbar (toolbar), location (address bar), ctions, status (status bar ),
Menubar, scrollbar, resizable, width, height, fullscreen
Screen), scrollbars (full screen without a scroll bar without parameters, channelmode (wide screen), left (Open Window x coordinates), top (open window y coordinates)
Window. location = 'view-source: '+ window. location. href application event view webpage source code;
A = new Date (); // create a as a new period object
Y = a. getYear (); // The value of y is the two-digit year from object.
Y1 = a. getFullYear (); // obtain the four-digit year count
M = a. getMonth (); // obtain the month value.
D = a. getDate (); // obtain the date value
D1 = a. getDay (); // obtain the value of the current week
H = a. getHours (); // obtain the current hour
M1 = a. getMinutes (); // get the current number of minutes
S = a. getSeconds (); // obtain the number of current seconds
Object. style. fontSize = "text size ";
Unit: mm/cm/in inch/pc/pt point/px pixel/em text height
1in = 1.25
1 pc = 12pt
1pt = 1.2px (800*600 resolution)
Text font attributes:
FontSize
Family font
Color
FontStyle. The value is normal, italic, and oblique italic and bold.
FontWeight bold, ranging from 100 to 900, 900 rough, light, normal, bold
LetterSpacing distance, change the text distance, value: 1pt, 10px, 1 cm
TextDecoration: Text modifier; optional values: none, underline, and overline
Background: Text background color,
BackgroundImage: background image. The value is the insert path of the image.
Click function call trigger on the webpage body:
1. onClick when an object is clicked
2. onLoad when a webpage is opened, it can only be written in the body
3. onUnload: When a webpage is closed or left, it can only be written in the body.
4. onmouseover when the mouse hangs 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 obtains the focus
9. onSelect when the object text is selected
10. onChange when the object content is changed
11. onBlur when the object loses focus
Onsubmit = return (ss () value returned when the form is called
Straight Line border-bottom: 1x solid black
Dotted Line border-bottom: 1x dotted black
Dash border-bottom: 2x dashed black
Double Line border-bottom: 5x double black
Slot border-bottom: 1x groove black
Ridge border-bottom: 1x ridge black
1. glow (color = color, strength = light size)

The webpage is automatically set as the homepage
Before defining the previous javascript cookie function:
Add

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.