JavaScript Grammar Collection Script Home basics recommended _javascript Tips

Source: Internet
Author: User
Tags lowercase setinterval
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 functional function xx () {...} defines 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 (resize), Width (width), height (high), fullscreen (full screen), scrollbars (full screen without scroll bar without parameters, 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) <br>
2. Horizontal Flip Fliph () to flip the object horizontally 180 degrees <br>
3. Flip FLIPV vertically () flip the object 180 degrees vertically <br>
4. Object fuzzy blur (Add=true/false direction= Direction strength= intensity)
Add specifies whether fuzzy direction fuzzy direction strength fuzzy intensity based on impression painting
5. Object transparent Alpha (OPACTION=0-100,FINISHOPACITY=0-100,STYLE=0/1/2/3)
Opaction object Overall Opacity value finishopacity the opacity value of the specified end transparent position when an object utilizes transparency the style specifies transparency 0 for overall transparency, 1 for line style transparency, 2 for circular transparency, 3 for rectangular transparency
6. Remove color chroma (color= color value) make the color in the object transparent to the same area as the specified color
7. Create Shadow DropShadow (color= shadow color, offx= horizontal to left pixel, offy= horizontal downward deviation pixels)
8. Go Color Gray () to make the object appear in grayscale
9. Negative effect invert () make the object appear negative effect
10. High-light light () to make the object appear black
11. Masking Mask (color= color) to make the entire object mask the specified color once


Opacity table transparency level. 0~100,0 table fully transparent, 100 table completely opaque
Finishopacity The gradient transparency effect that the table wants to set. 0~100.
Shape of the style table transparent area. 0 Table uniform shape. 1 Table linear. 2 Table radial. 3 table rectangles.
Startx.starty the x and Y coordinates at the start of the table gradient transparency effect.
Finishx,finishy the x,y coordinates at the end of the gradient transparency effect.
Add has to determine if there is an original target in the blur effect. The value is 0,1.0 table "No", 1 table "Yes".
Direction sets the direction of the blur. The 0 degree table is vertically up and 45 degrees to one unit. The default value is 270 degrees to the left. Left,right,down,up.
Strength can only be determined with integers. The width of the number of pixels represented by the pixel will be blurred. The default is 5.
Color to be transparent.
Offx,offy is the offset of the x,y direction shadow respectively.
Positive refers to the projection way. 0 table transparent pixels generate shadows. 1 tables give only opaque pixels to generate shadows ...


Addambient: Join the surround light source.
Addcone: Add cone light source.
Addpoint Add Point Light source
Changcolor: Change the color of the light.
Changstrength: Change the intensity of the light source.
Clear: Clears all the lights.
Movelight: Move the light source.


The freq is the frequency of the ripples and the number of finished ripples that are required to be generated on the object's upper area.
Lightstrength can enhance the effect of light and shade for ripple. Significant 0~100 positive integer, sine wave start position is 0~360度. The 0 table starts at 0 degrees and the 25 table starts at 90 degrees.
Strength table amplitude size.
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.