JavaScript syntax highlights basics _ javascript skills

Source: Internet
Author: User
The JavaScript syntax collection is a summary of common javascript Functions. It is more practical and recommended to be added to favorites to facilitate searching for required information. 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 pid. 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 ), scrollbars (no scroll bar and no parameter in full screen mode, channelmode (wide screen), left (opening window x coordinate), top (opening window y coordinate)
Window. location = \ 'view-source: \ '+ window. location. href Application Event to view the 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)

2. fliph () enables the object to flip 180 degrees horizontally.

3. Vertical flip flipv (): 180 degrees vertical flip of Objects

4. object fuzzy blur (add = true/false direction = direction strength = intensity)
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 (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.
Coordinates of x and y at the end of the finishx and finishy gradient transparency effect.
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 can only be determined by an integer. It indicates that the width of the number of pixels will be blurred. The default value is 5.
The color must be transparent.
Offx and offy are respectively the offsets of shadows in the x and y directions.
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.
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.