JS Common Events

Source: Internet
Author: User

1. onblur: (used in form elements, when the element loses focus)2. OnChange: (used in form elements, when something changes is performed)3. OnClick: (Executes when mouse clicks on an element)4. OnDblClick: (executes when the mouse double-clicks an element)5. onfocus: (used in form elements, when the element gets focus)6. onkeydown: (performed when a key is pressed)7. onkeypress: (performed when a key is pressed and released)8. onkeyup: (performed when a key is released)9. OnLoad: (for use in body tag, loading page when executing)10. OnMouseDown: (Performed when the mouse button is pressed)11. OnMouseMove: (executes when the mouse cursor moves over an element)12. onmouseout: (executes when the mouse cursor moves away from an element)13. onmouseover: (executes when the mouse cursor moves over an element)14. OnMouseUp: (Performed when the mouse button is released)15. OnReset: (used in form elements when the form is reset)16. Onselect: (used in form elements when the element is selected)17. OnSubmit: (used in form elements when the form is submitted for execution)18. OnUnload: (used in the body tag when the page is closed when executed) common small knowledge points:22the. Click () object. Click () causes the object to be clicked. 23.closed object. Closed Object window is closed True/false 24. Cleartimeout (object) clears the SetTimeout object that has been set25. Clearinterval (object) clears the SetInterval object that has been set26.confirm ("Hint message") Popup Confirmation box, OK return true cancel return false27.cursor: Style change mouse style hand crosshair text wait HelpdefaultAuto E/s/w/n-resize 28. 29. Event.clientx returns the x-coordinate value of the last mouse click;30. Event.clienty returns the last mouse-click y-coordinate value;31. Event.offsetx returns the current mouse-hover x-coordinate value32. Event.offsety returns the current mouse-hover y-coordinate value33. 34. document.write (document.lastmodified) page last update time35.document.ondblclick=x when you double-click the mouse to generate events36.document.onmousedown=x click mouse button to generate event37. 38. Document.body.scrollTop; Returns and sets the coordinate value of the current vertical scroll bar, which must be mated with the function,39. Document.body.scrollLeft; Returns and sets the coordinate value of the current horizontal scrolling service, which must be mated with the function,40.document.title document.title= "Message"the title bar text of the current window41.document.bgcolor document.bgcolor= "Color value"; Change the window background color42.document. Fgcolor document. fgcolor= "Color Value"; Change the color of the body43.document.linkcolor document.linkcolor= "Color value"; Change the color of the hyper join44.document.alinkcolor document.alinkcolor= "Color value"; Change the color of the right-click Join45.document. Vlinkcolor document. vlinkcolor= "Color Value"; Change the color of the visited join46. Document.forms.length returns the current page form list singular47. Document.anchors.length returns the number of anchors for the current page48. Document.links.length returns the number of current page joins49.document.onmousedown=x Click the mouse to trigger the event50.document.ondblclick=x double-click Mouse Trigger Event51.defaultStatus window.status=defaultstatus; Set the status bar to the default display52. 53.function functionxx () {...} definition function54. IsNumeric Judging whether it is a number55.innerHTML xx=object. InnerHTML Enter the HTML source code in an object tag56.innerText divid.innertext=XX will set the value of the object named with Div to xx57. 58. Location.reload (); To refresh this page, target can be equal to a refreshed Web page59. 60.math.random () random number, can only be between 0 and 1, if you want to get the other number, it is *10, and then take the whole61. Math.floor (number) Converts an object number to an integer, rounding all decimals62.math.min () returns which small63.math.max () back to which big64. 65. Navigator.appname returns the current browser name66. Navigator.appversion returns the current browser version number67. Navigator.appcodename returns the current browser code name68. Navigator.useragent returns the current browser user token69. 70.onsubmit onsubmit= "return (XX ())"using function return values71. Opener Opener.document. Object control original Open Form Object72. 73.prompt xx=window.prompt ("Hint message", "predetermined value"); Input Statement74. Parent parent. Frame name. Object Control Framework Page75. 76.return return falsereturn value77. Random parameters (between 0 and 1)78. Reset () Form.reset (); Reset the data in form form79. 80.split ("") String.Split ("")) Separates string object characters utilises commas81the. Submit () Form object. Submit () Causes the Form object to commit the data82. 83. The CharAt (x) object of the String object returns the letter of the number of bits of the specified object84.lastIndexOf ("string") right-to-left polling for the specified character, no return-1 85.indexOf ("string") from left to right to inquire for the specified character, no return-1 86. lowercase () Convert all objects to lowercase87. Uppercase () Convert all objects to uppercase88.substring (0,5) string.substring (x,x) returns the characters from 0 to 5 in the object89.setTimeout ("function", time) to set a timeout object90.setInterval ("function", time) to set a timeout object91. 92. toLocaleString () x.tolocalestring () Gets the time from the X-time object, as a string type exists93.typeof(variable name) Check the type of the variable, the value is: string,boolean,object,function,underfined94. 95.window.event.button==1/2/3the left mouse button equals 1 right key equals 22 keys pressed together as 396. Window.screen.availWidth returns the current screen width (blank space)97. Window.screen.availHeight returns the current screen height (blank space)98. Window.screen.width returns the current screen width (resolution value)99. Window.screen.height returns the current screen height (resolution value)100. Window.document.body.offsetHeight; Returns the current page height101. Window.document.body.offsetWidth; Returns the current page width102.window.resizeto (0,0) to set the window to a wide height103.window.moveto (0,0) to move the window to a location104. Window.focus () to get the focus of the current window105. Window.Scroll (x, y) window scrollbar coordinates, y control up and down, need to mate with function106.window.open () window.open ("Address", "Name", "Properties")    107. Properties: Toolbar (Toolbar), location (address bar), Directions,status (status bar ),108. MenuBar (menu bar), scrollbar (scroll bar), resizable (change size), Width (width), height (high), fullscreen (full screen), scrollbars (no scroll bar without parameters at full screen, Channelmode (Widescreen), left (open window x-coordinate), Top (open window y-coordinate)109.window.location = ' View-source: ' +window.location.href Application Event View Web page source code; 110. 111. 112.a=NewDate ();//create a for a new time object113.y=a.getyear ();//the value of Y is the two-digit year from object A that gets the year value114.y1=a.getfullyear ();//get four-digit year of the year115.m=a.getmonth ();//Get Month value116.d=a.getdate ();//Get Date value117.d1=a.getday ();//Gets the current week value118.h=a.gethours ();//gets the current number of hours119.m1=a.getminutes ();//gets the current number of minutes120.s=a.getseconds ();//gets the current number of seconds121. 122. 123. Object. style.fontsize= "Text Size"; 124. Unit: mm/cm/in inch/pc pa/pt point/px pixels/em Text High125.1inch=1. 25cm126.1pc=12pt127.1PT=1.2PX (800*600 resolution)128. 129. Text Font properties:130. FontSize size131. Family Fonts132. Color Colors133. FontStyle style, value is normal, italic italic, oblique italic and bold134. FontWeight bold, with values ranging from 100 to 900, 900 the most coarse, light,normal,bold135. letterspacing spacing, change the distance between text, value is, 1pt,10px,1cm136. textdecoration: text decoration; value, none not decorated, underline underlined, Overline underlined137. Background: Text background color,138. BackgroundImage: Background image, value as the insertion path of the picture139. 140. 141Click the Web body function to invoke the trigger:142. 143.1. OnClick when the object is clicked144.2. OnLoad when the Web page opens, can only be written in the body145.3. OnUnload when a webpage is closed or left, it can only be written in body146.4. onmouseover when the mouse hangs over it147.5. onmouseout when the mouse leaves the object148.6. onmouseup when the mouse is released149.7. onmousedown when the mouse presses the key150.8. onfocus when an object gets focus151.9. OnSelect when the text of an object is selected152.10. OnChange when the contents of an object are changed153.11. OnBlur when an object loses focus154.onsubmit=returnthe value returned when the table is monotonic (SS ())155. 156. Straight border-bottom:1x solid Black157. Dashed border-bottom:1x dotted Black158. Dot Dash border-bottom:2x Dashed Black159. Double Wire border-bottom:5xDoubleBlack160. Trough-shaped border-bottom:1x Groove Black161. Ridge-Shaped border-bottom:1x Ridge Black162. 163. 164.1. Edge Highlight Glow (color= color, strength=Light size)165. 166.2Horizontal Flip Fliph () flips the object horizontally 180 degrees167. 168.3Vertical Flip FLIPV () flips the object vertically 180 degrees169. 170.4. Object blur Blur (add=true/false direction= Direction strength= strength) 171. Add specifies whether fuzzy direction fuzzy direction strength fuzzy intensity according to impression Painting School172.5. Object transparent Alpha (OPACTION=0-100,FINISHOPACITY=0-100,STYLE=0/1/2/3) 173the. Opaction object's overall opacity value finishopacity when the object takes advantage of the fade transparency when the item specifies an opaque value that ends the transparent position the style specifies transparent mode 0 is overall transparent, 1 is line-transparent, 2 is round transparent, and 3 is rectangle transparent174.6. Remove Color Chroma (color=color values) make the color in the object the same area as the specified color transparent175.7. Create Shadow DropShadow (color= shadow color, offx= horizontal left pixel, offy=horizontal downward deviation from pixels)176.8Color Gray () to display the object in grayscale177.9. Negative effect Invert () causes the object to have a negative effect178.10. Highlight light () to make the object appear black179.11. Cover Mask (color=color) causes the entire object to mask one time with the specified color180. 181.opacity table transparency level. 0~100, 0 sheets fully transparent, 100 sheets completely opaque182.finishopacity table you want to set the gradient transparency effect. 0~100. 183. style table The shape of the transparent area. 0 Table uniform shape. 1 Table linear. 2 Table radial. 3 Table rectangle. 184the. Startx.starty table the start of the gradient transparency effect at the x and y coordinates. 185. Finishx,finishy the coordinates of x, y at the end of the fade transparency effect. 186.add has to determine if the original target is in the blur effect. The value is 0,1.0 table "No", 1 table "Yes". 187. Direction sets the direction of the blur. The 0-degree table is vertically upward and 45 degrees is one unit. The default value is 270 degrees to the left. Left,right,down,up. 188the. Strength can only be determined with integers. The width of the number of pixels represented is blurred. The default is 5. 189. Color to be transparent. 190The . Offx,offy is the offset of the X, Y direction shadow respectively. 191. Positive refers to the projection mode. 0 Table transparent pixels generate a shadow. 1 table gives only opaque pixels to generate shadows. 192. 193.   Addambient: Joins the surrounding light source. 194.   Addcone: Add cone light source. 195. Addpoint Adding Point Light196.   Changcolor: Change the color of the light. 197.   Changstrength: Change the intensity of the light source. 198.   Clear: Clears all lights. 199.   Movelight: Move the light source. 200. 201The . Freq is a ripple frequency that specifies how many finished ripples need to be generated on an area of the object. 202.lightstrength can enhance the effect of light and shadow. Significant 0~100 positive integer, sine wave starting position is 0~360 degrees.   0 tables start at 0 degrees, and 25 tables start at 90 degrees. 203. Strength table amplitude size. 204. 205. 206.hand style= "Cursor:hand" 207.crosshair style= "Cursor:crosshair" 208.text style= "Cursor:text" 209.wait style= " Cursor:wait "210.defaultStyle= "Cursor:default" 211.help style= "cursor:help" 212.e-resize style= "cursor:e-resize" 213.ne-resize style= "cursor : Ne-resize "214.n-resize style=" cursor:n-resize "215.nw-resize style=" cursor:nw-resize "216.w-resize style=" cursor: W-resize "217.s-resize style=" cursor:s-resize "218.sw-resize style=" cursor:sw-resize "219.se-resize style=" cursor: Se-resize "220.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.