Convenient query of JavaScript objects, attributes, and event manuals

Source: Internet
Author: User
Tags natural logarithm number strings

Windows objects
The top-level object of each HTML document.
Attribute
Frames [] sublists array. Each sublists array is stored in the order defined in the source document.
Feames. length: Number of child partitions.
Self current window.
Parent window (the current window is a Child Window ).
Top-level window (the parent window of all visible windows ).
Status browser status window message.
DefaultStatus: the default message displayed in the browser status window when status is invalid.
Name: the internal name defined by the window opened by the window. open () method.

Windows Method
Alert ("message") displays the "JavaScript Alert" dialog box containing the given message.
Confirm ("message") displays the "Confirm" dialog box containing the given message (there is an OK button and a Cancel button). If you click OK, return true; otherwise, return false.
The prompt ("message") displays a "prompt" dialog box. You are required to provide corresponding input based on the displayed message.
Open ("URL", "name") opens a new window with a specified name.
Close () close the current window.

Frame object
It is a subwindow of the entire browser window. Besides the status, defaultStatus, and name attributes, it has all the properties of the window object.
Location object
Contains information about the current URL.
Attribute
The entire URL string of href.
The protocol contains the first part of the URL, such as http:
Host contains a string containing the host name in the URL: port number, for example, // www.shimianren.com/ask/
Hostname a string containing the host name in the URL. Such as a http://www.shimianren.com
Port contains the possible port number strings in the URL.
The part after "/" in the pathname URL. For example ~ List/index.htm
String after hash "#" (CGI parameter.
Search "? "# (CGI parameter.

Document Object
Objects that contain information about the current document.
Attribute
Title: The title of the current document. If not defined, it contains "Untitled ".
The full URL of the location document.
LastModified contains the last modification date of the document.
The URL of the referrer caller, that is, the URL from which the user is linked to the current page.
BgColor background color (# xxxxxx)
FgColor foreground text color.
The color of the linkColor hyperlink.
The hyperlink color accessed by vlinkColor.
AlinkColor activates the link color (when the mouse is not placed ).
Forms [] array of form objects in the document, which are stored in the defined order.
The number of form objects in the forms. length document.
Links [] is an array object corresponding to all HREF links in the document. Storage is defined in order.
The number of HREF chains in the links. length document.
Anchors [] anchors (...) array, which defines storage in order.
Anchors. length the number of anchors in the document.

Method
Write ("string") to highlight the string to the current window. (The string can contain HTML tags)
Writeln ("string") is similar to write (). It appends a carriage return character at the end, only in the PRE-formatted text (<PRE>... </PRE> or <XMP>... </XMP>.
Clear () clears the current window.
Close () close the current window.

Form object
Attribute
Name
The string value of the NAME attribute in.
Class value of the method attribute in METHOD, "0" = "GET", "1" = "POST ".
The string value of the action attribute in the ACTION.
Target table data submission target, which is consistent with the corresponding attribute in the tag.
The elements [index] elements attribute contains all elements in form.
Number of elements in the length table.

Method
Submit () submit the table.
The event processor onSubmit () user clicks a defined button to submit the code that runs when the form is submitted.

Text and textarea objects
Attribute
The string value of the name NAME attribute.
The string value of the value Field.
The initial string value of the defaultValue field.

Method
Focus () sets the object input focus.
Blur () removes the input focus from the object.
Select () the input area of the selected object.

Event Processor
OnFocus is executed when the input focus enters.
OnBlur is executed when the domain loses focus.
OnSelect is scheduled to run when some text in the field is selected.
OnChange is executed when the domain loses focus and the domain value changes from the onFocus execution.

Check box object
Attribute
The string value of the name NAME attribute.
The string value of the value Check box. If it is set, it is "on"; otherwise, it is "off ".
A boolean value of the checked check box. If it is set, it is true; otherwise, it is false.
DefaultChecked indicates the Boolean value of the (CHECKED) attribute (default state ).

Method
Click () Select the check box and make it "on ".

Event Processor
OnClick: it is executed when the user clicks Checkbox.

Radio button (radio) object
Attribute
The string value of the name NAME attribute.
The number of radio buttons in the length radio object.
The string value of the VALUE property.
Boolean value of checked. Press true. Otherwise, the value is false.
DefaultChecked indicates the Boolean value of the CHECKED attribute value.

Method
Click () Select a single button.

Event Processor
OnClick: scheduled to run when the single-choice button is selected.

Select object
Attribute
The number of objects in the length select object.
Name is the internal NAME of the select object defined by name = attribute.
The subscript of the currently selected option in the selectedIndex select object.
Options this attribute corresponds to the content marked when the select object is defined in HTML. It has the following attributes:
Text string marked by text.
Value of the VALUE Attribute. When the Submit button is pressed, the value is submitted.
DefaultSelected reflects the Boolean value of the marked SELECTED attribute.
The Boolean value that indicates the current selection status of the option.

Event Processor
OnFocus is executed when the input focus enters the domain.
OnBlur is executed when the domain loses the input focus.
OnChange: When the domain loses focus and the value of the domain changes compared to the onFocus execution, onChange is executed.

Button Object
There are three types of buttons in the table, which are defined by the TYPE attribute in the <INPUT> tag:
. Submit (type = "SUBMIT ")
. Reset (type = "RESET ")
. Custom (type = "BUTTON ")
All button objects have the following components:
Attribute
The string value of the VALUE property.
The string value of the name NAME attribute.

Method
Click () select button

Event Processor
OnClick: Execute when the button is clicked.

Submit and reset objects
Attribute
Value VALUE = attribute content.
Name NAME = attribute content.

Method
Click () select button

Event Processor
OnClick: Execute when the button is clicked.

Password object
Attribute
DefaultValue VALUE = attribute content.
Name NAME = attribute content.
Value currently enters data in the password field.

Method
Focus () brings the focus to the password field.
Blur removes the focus from the password field.
Select () select the current data in the password field for modification.

Navigator object
This object is used to determine the Navigator version used for user access.
Attribute
AppCodeName: "codename" relative to the user's browser"
The actual name of the appName relative to the user's browser.
The version of appVersion relative to the user's browser.
UserAgent this attribute reflects all information about the user's browser.

History Object
History. go (-1), return to the previous page

String object
The string object provides many methods for operating the string content.
Attribute
Length: the number of characters in the string.

Method
Big (), blink (), bold (), fixed (), italics (), small (), sub (), strike (), sup (), fontColor (color), fontSize (size)
The above method adds the corresponding HTML tag for the string.
CharAt (index) returns the character at index in the string.
IndexOf (searchValue, [fromIndex]) This method searches for the first searchValue in the string. If fromIndex is specified
The position in the string to start searching. When the searchValue is found, the position of the first character in the string is returned.
LastIndexOf (searchValue, [fromIndex]) Searches the searchValue forward from the end of the string and reports the First Instance found.
Substring (indexA, indexB) obtains the substring from indexA to indexB.
ToLowerCase (), toUpperCase () converts all characters in the string to uppercase and lowercase.

Date object
To use the Date object, you must first create a Date instance:
Variable name = new Date ();
Method
GetDay (), getDate (), getHours (), getMinutes (), getMonth (), getSeconds (), getTime (),
GetTimeZoneOffset (), getYear ()
And setDay ......
ToGMTString () returns the current time in GMT format. (Sun, 12 Feb 1999 14:19:22 GMT)
ToLocaleString returns the current time in locale Format. (03/11/99 14:19:22)
Parse (date) converts a normal date string into a haoss format, and then sets a parameter for setTime.

Math object
Attribute
LN10 (natural logarithm of 10)
PI (1415926 ...)
SQRT1_2 (square root of 1/2)
Method
Abs (x) returns the absolute value of x.
Acos (x) returns the arc cosine value of x.
Asin (x) returns the arc sin value of x.
Atan (x) returns the arc tangent value of x.
Ceil (x) returns the smallest integer greater than or equal to x.
Cos (x) returns the cosine value of x.
Exp (x) returns the x power of e.
Floor (x) returns the largest integer less than or equal to x.
Log (x) returns x's
Max (x, y) returns values in x, y.
Min (x, y) returns a small value in x and y.
Pow (x, y) returns the yth power of x.
Round (x) to the nearest integer (rounded off if it is less than or equal to 0.5 decimal places)
Sin (x) returns the sin value of x.
Sqrt (x) returns the square root of x.
Tan (x) returns the tangent value of x.

 

Javascript Event Query Synthesis
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, location, ctions, status, menubar, scrollbar, resizable, width ), height), fullscreen (full 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) <br>
2. fliph () enables the object to flip 180 degrees horizontally. <br>
3. Vertically flip flipv () to make the object vertically flip 180 degrees <br>
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.


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"

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.