Common JS attributes and functions

Source: Internet
Author: User
Event. clientx Returns the last mouse X coordinate value;
Event. clienty Returns the Y coordinate value of the last mouse clicked;
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 page update time
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 body color
Document. linkcolor Document. linkcolor = "color value "; Change the connection 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 connection
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 trigger event
Document. ondblclick = x Double-click trigger event
Defaultstatus Window. Status = defaultstatus; Set the status bar to display by default
Function Function XX (){...} Define functions
Isnumeric Determine if it is a number
Innerhtml Xx = object. innerhtml Enter html in an object tag Source code
Innertext Divid. innertext = xx Set the value of the object located in the DIV named after Id to xx
Location. Reload (); Refresh this page. The target can be equal to a refreshed webpage.
Math. Random () Random Number of Han, which can only be the number between 0 and 1. To obtain other numbers, it can be * 10 and then rounded up.
Math. Floor (number) Convert the object number to an integer and remove all decimals.
Math. Min (1, 2) Which of the following values is returned?
Math. Max (1, 2) Which of the following values is returned?
Navigator. appname Returns the name of the current browser.
Navigator. appversion Returns the current browser version number.
Navigator. appcodename Return to current Browser Code Name
Navigator. useragent Returns the user ID of the current browser.
Onsubmit Onsubmit = "Return (XX ())" Function return value
Opener Opener.doc ument. Object Controls the original open form object
Prompt Xx = Window. Prompt ("prompt message", "Reservation Value "); Input statement
Parent Parent. Framework name. Object Control Framework page
Return Return False Return Value
Random Random parameter (between 0 and 1)
Reset () Form. Reset (); Reset data in Form
Split ("") String. Split ("") Separate String object characters with commas
Submit () Form object. Submit () Submit data to form object
String object Charat (x) object Returns the number of characters in the specified object.
Lastindexof ("string ") No-1 is returned for the specified character from right to left.
Indexof ("string ") Query the specified character from left to right.-1 is not returned.
Lowercase () Convert all objects to lowercase letters
Uppercase () Convert all objects to uppercase
Substring (0, 5) String. substring (x, x) Returns the characters from 0 to 5 in the object.
SetTimeout ("function", time) Set a timeout object
Setinterval ("function", time) Set a timeout object
Tolocalestring () X. tolocalestring () Obtains the time from the X time object and exists as a string.
Typeof (variable name) Check the type of the variable. The values include string, Boolean, object, function, and underfined.
Window. event. Button == 1/2/3 The left mouse button is equal to 1, right mouse button is equal to 2, and press 3 together
Window. Screen. availwidth Returns the current screen width (blank space)
Window. Screen. availheight Return 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)
Parameter parameter Doc ument. Body. offsetheight; Returns the current webpage height.
Specified parameter Doc ument. Body. offsetwidth; Returns the current webpage width.
Window. resizeTo (0, 0) Set the window width and height
Window. moveTo (0, 0) Move the window to a certain position
Window. Focus () Focus the current window
Window. Scroll (x, y) Coordinates of the window scroll bar. y controls the movement up and down and must be used with functions.
Window. open () Window. Open ("Address", "name", "attribute ")
Attributes: toolbar (toolbar), location (address bar), ctions, status (status bar ),
Menubar, scrollbar, and resizable ), Width (width), height (height), fullscreen (full screen), scrollbars (full screen without scroll bar parameters, channelmode (wide screen), left (Open Window X coordinates ), top (open the Y coordinate of the window)
Window. Location = 'View-Source :' + Window. Location. href View the source code of the web page for application events;

A = newDate ();// Create a as a new period object
Y = A. getyear ();// The value of Y is the year value obtained from object.Two-digit year
Y1 = A. getfullyear ();// Obtain the annual number of copiesFour-digit year
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 ();// Obtain 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. onclickWhen an object is clicked
2. onloadWhen a webpage is opened, it can only be written in the body.
3. onUnloadWhen a webpage is closed or left, it can only be written in the body.
4. onmouseoverWhen the mouse hangs over it
5. onmouseoutWhen the mouse leaves the object
6. onmouseupWhen the mouse is released
7. onmousedownWhen you press the key
8. onfocusWhen the object obtains the focus
9. onselectWhen the object text is selected
10. onchangeWhen the object content is changed
11. onblurWhen the object loses focus
Onsubmit = return (SS () value returned when the form is called
Straight LineBorder-bottom: 1xSolidBlack
Dotted LineBorder-bottom: 1xDottedBlack
DashesBorder-bottom: 2xDashedBlack
Dual LineBorder-bottom: 5xDoubleBlack
SlotBorder-bottom: 1xGrooveBlack
RidgeBorder-bottom: 1xRidgeBlack

1. Glow (color = color, strength = light size)

2. fliph ()Turning objects horizontally to 180 degrees

3. Vertical flip flipv ()Vertical object flip 180 degrees

4. Fuzzy blur (add = true/false Direction = direction Strength = strength)
Add: Specifies whether to perform fuzzy direction based on the impression style; fuzzy direction: strength; fuzzy intensity
5. transparent object alpha (opaction = 0-100, finishopacity = 0-100, style = 0/1/2/3)
Opaction object overall opacity value finishopacity when the object uses the progressive transparency, this specifies the end transparency position opacity value. Style specifies the transparency mode. 0 indicates the overall transparency, 1 indicates the linear transparency, and 2 indicates the circular transparency, 3. rectangular transparency
6. Remove the color chroma (color = color value) to make the color area of the object transparent with the specified color
7. Create a shadow dropshadow (color = shadow color, offx = horizontal deviation from the pixel to the left, offy = horizontal deviation from the pixel)
8. Color-removing gray () enables gray-scale display of Objects
9. Negative Effect invert (): displays negative effects on objects.
10. Highlight light (): displays the object in black.
11. Mask mask (color = color) so that the entire object is masked once in the specified color
Opacity Table transparency level. 0 ~ 100, 0 tables are completely transparent, and tables are completely opaque
Gradient transparency to be set in the finishopacity table. 0 ~ 100.
Style Table transparent area shape. 0 table uniform shape. 1 Table linear. 2 Table radiology. 3 Table rectangle.
The X and Y coordinates at the beginning of the gradient transparency effect in the startx. starty table.
Finishx, finishy gradient transparent effect end X, Y Coordinates.
Add to determine whether to make the original target in the blur effect. The value is 0, 1.0 table "no", 1 Table "yes ".
Ction sets the direction of The Blur. 0 degrees the table is vertical up, 45 degrees is a unit. The default value is 270 degrees to the left. Left, right, down, up.
Strength Only integers can be used to determine the number of pixels. The width will be blurred. The default value is 5.
The color must be transparent.
Offx and offy are respectively X and Y. The offset of the direction shadow.
Positive refers to the projection method. 0 table transparent pixel shadow generation. 1 Table only gives opaque pixel shadow generation ..
Addambient: adds a surrounded light source.
Addcone: Add a conical light source.
Addpoint
Changcolor: change the color of light.
Changstrength: changes the intensity of the light source.
Clear: Clear all light sources.
Movelight: mobile light source.
Freq is the ripple frequency. It specifies the number of finished ripple to be generated in the area on the object.
Lightstrength can be used to enhance the effect of ripple-shaped light and shadow ~ 100 positive integer. the start position of the sine wave is 0 ~ Table 0 starts from 0 degrees and Table 25 starts from 90 degrees.
The amplitude of the Strength table.

hand style = "cursor: Hand"
crosshair style = "cursor: crosshair"
text style = "cursor: text "
wait style =" cursor: Wait "
default style =" cursor: default "
help style =" cursor: Help "
E-resize style =" cursor: e-resize "
Ne-resize style =" cursor: NE-resize "
N-resize style =" cursor: n-resize "
NW-resize style =" cursor: NW-resize "
W-resize style =" cursor: w-resize "
S-resize style =" cursor: S-resize "
Sw-resize style =" cursor: sw-resize "
Se-resize style =" cursor: Se-resize "
auto style =" cursor: auto "

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.