JavaScript objects, attributes, event manuals collection Easy to query _ basics

Source: Internet
Author: User
Tags getdate html tags lowercase natural logarithm setinterval sin square root

Windows object
The top-level object for each HTML document.
Property
Frames[] An array of child frames. Each child frame array is stored in the order defined in the source document.
Feames.length of the number of child frames.
Self Current window.
Parent Parents window (the current window is one of the child windows).
Top top-level window (is the parent window for all visible windows).
The message on the Status Browser state window.
Defaultstatus The default message that appears on the Browser status window when status is not valid.
Name Internal name, which is defined by the window that is opened by the window.open () method.

Windows methods
Alert ("message") Displays the JavaScript Alert dialog box that contains the given message.
Confirm ("message") Displays the "Confirm" dialog box (with an OK button and a Cancel button) that contains the given message. Returns FALSE if the user clicks OK to return true.
The prompt ("message") displays a "Prompt" dialog box that requires the user to give the appropriate input based on the display message.
Open ("URL", "name") opens a new window, giving a specified name.
Close () Closes the current window.

The

Frame Object
is a child of the entire browser window, and it has all the properties of the Window object, in addition to the Status,defaultstatus,name property.
  The Location object
contains information about the current URL.
  Property
href The entire URL string.
Protocol A string containing the first part of the URL, such as http:
Host contains a string containing the host name in the URL: the part of the port number.//www.shimianren.com/ask/
Hostname  A string containing the host name in the URL. such as Http://www.shimianren.com the
Port contains the port number string that may exist in the URL.
  Pathname after the "/" in the URL. A string after the ~list/index.htm
Hash "#" (CGI parameter).
Search "?" String after the number (CGI parameter).

Document Object
An object that contains information about the current document.
Property
Title of the current document, if not defined, contains "untitled".
Location the full URL of the document.
LastModified contains the date the document was last modified.
Referrer the caller URL, which is the URL from which the user is linked to the current page.
bgcolor background color (#xxxxxx)
Fgcolor foreground text color.
LinkColor the hyperlink color.
Vlinkcolor the hyperlink color accessed.
Alinkcolor Activate chain color (when mouse hold is not placed).
Forms[] An array of form objects in the document, stored in a defined order.
Forms.length the number of form objects in the document.
Links[] The array object that corresponds to all the href chains in the document, defining the store in order.
The number of href chains in the Links.length document.
Anchors[] Anchor (...) Array, which defines the storage in order.
Anchors.length the number of anchors in the document.

Method
Write ("string") highlights the string to the current window. (Strings can contain HTML tags)
Writeln ("string"), similar to write (), appends a carriage return at the end and only takes effect in the intended format text (<PRE>...</PRE> or <XMP>...</XMP>).
Clear () the current window.
Close () Closes the current window.

Form Object
Property
Name
The string value of the Name property in the
Class value of Method attribute in method, "0" = "Get", "1" = "POST".
The string value of the Action property in the action.
Target table data submission is consistent with the corresponding attribute in the tag.
The Elements[index] Elements property contains the individual elements in the form.
The number of elements in the length table.

Method
Submit () Submission form.
Event handler onsubmit () the code that runs when a user clicks a defined button to submit form.

Text and TextArea objects
Property
The string value of the name Name property.
The string value for the content of the value field.
DefaultValue the initial string value of the field contents.

Method
Focus () Sets the object input focal point.
Blur () Removes the input focus from the object.
Select () The input area of the selected object.

Event handlers
Onfocus executes when the input focus is entered.
OnBlur is executed when the domain loses focus.
Onselect executes when some text in a field is selected.
OnChange executes when the domain loses focus and the domain value is changed relative to the onfocus execution.

check box (CheckBox) object
Property
The string value of the name Name property.
The string value of the contents of the Value check box. On if set, or off.
Boolean value for the contents of the Checked check box. True if set, or false.
defaultchecked reflect (CHECKED) The Boolean value of the property (the default state).

Method
Click () to select the check box and make it state "on".

Event handlers
OnClick executes when the user clicks the checkbox.

Radio button (radio) object
Property
The string value of the name Name property.
Length radio The number of radio buttons in the object.
The string value of the value Value property.
Checked Boolean value, press True, otherwise false.
Defaultchecked A Boolean value that reflects the value of the checked property.

Method
Click () Select the Order button.

Event handlers
OnClick executes when the radio button is selected.

Select Object
Property
The number of objects in the length select object.
Name is the internal name of the select object defined by the Name= property.
SelectedIndex the subscript of the currently selected option in the Select object.
Options This property corresponds to the contents of the tag when you define a Select object in HTML, and it has the following properties:
Text string that is marked with text.
Values of the value Value property, which is committed when the submit button is pressed.
Defaultselected A Boolean value that reflects the selected property of the tag.
Selected a Boolean value that reflects the current selection state of option.

Event handlers
Onfocus executes when the input focus is entered into the domain.
OnBlur is executed when the field loses input focus.
OnChange executes onChange when the domain loses focus and if the value of the domain changes relative to onfocus execution.

Button Object
There are three types of buttons in the table defined by the type attribute in the <INPUT> tag:
. Submit (Type= "Submit")
. Reset (type= "reset")
. Custom (type= "button")
All button objects have the following ingredients:
Property
The string value of the value Value property.
The string value of the name Name property.

Method
Click () Select button

Event handlers
OnClick executes when the button is clicked.

Submit and Reset Objects
Property
The contents of the Value value= property.
The contents of the name Name= property.

Method
Click () Select button

Event handlers
OnClick executes when the button is clicked.

Password objects
Property
DefaultValue the contents of the Value= property.
The contents of the name Name= property.
Value currently enters the data for the password field.

Method
Focus () takes you to the password field.
Blur removes the focus from the password domain.
Select () selects the current data in the Password field for modification.

Navigator Objects
This object is used to determine the navigator version that is used when the user accesses.
Property
appCodeName "codename" relative to the user's browser
AppName the actual name relative to the user's browser.
AppVersion The version number relative to the user's browser.
UserAgent This property reflects all the information in the user's browser.

History objects
History.go (-1), back to previous page

String Object
A String object provides a number of ways to manipulate the contents of a string.
Property
Length string, that is, 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 appropriate HTML markup for the string.
CharAt (index) returns the character at index in the string.
IndexOf (Searchvalue,[fromindex]) This method searches the string for the first occurrence of the searchvalue. If a fromindex is given, the
The position within the string begins the search, and when Searchvalue is found, returns the position of the first character of the string.
LastIndexOf (Searchvalue,[fromindex]) searches searchvalue from the tail of the string and reports the first instance found.
SUBSTRING (INDEXA,INDEXB) gets 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 be 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 the normal date string to a settime () parameter.

Math Object
Property
LN10 (natural logarithm of 10)
PI (3.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-second side of E
Floor (x) returns the largest integer less than or equal to X
Log (x) returns X's
Max (x,y) returns a large value in X,y
MIN (x,y) returns the decimal value in X,y
POW (x,y) returns the Y-second side of X
Round (x) rounded to the nearest integer, (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
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"; The title bar text of the current window
Document.bgcolor document.bgcolor= the color value; Change the window background color
document. Fgcolor document. fgcolor= "color value"; Change the body color
document.linkcolor document.linkcolor= "color value"; Change the hyperlink color
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 Click to trigger Events
Document.ondblclick=x Double-click the mouse to trigger the event
defaultstatus   Window.status=defaultstatus; The status bar settings are displayed by default

function function xx () {...} Defining 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 (change size), Width (width), Height), fullscreen (full screen), scrollbars (no scroll bar without parameters in full screen, 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 Highlights Glow (color= color, strength= brightness size) <br>
2. Flip horizontal fliph () to flip the object horizontally to 180 degrees <br>
3. Flip the FLIPV vertically () Causes an object to flip vertically 180 degrees <br>
4. Object blur Blur (Add=true/false direction= Direction strength= intensity)
Add specifies whether the fuzzy direction fuzzy direction strength The fuzzy intensity by the impression painter
5. Object Transparent Alpha (OPACTION=0-100,FINISHOPACITY=0-100,STYLE=0/1/2/3)
Opaction an opaque value of an object as a whole finishopacity the opacity value of the specified end transparent position when the object utilizes transparency specifies transparent mode 0 for overall transparency, 1 for line style transparency, 2 for circular transparency, 3 for rectangle Transparency
6. Remove Color Chroma ( Color= color value) makes the color in the object transparent to the same area as the specified color
7. Create a Shadow DropShadow (color= shadow color, offx= horizontal to left pixel, offy= horizontal down pixels)
8. Go to Color Gray () to make the object appear in grayscale
9. The negative effect invert () causes the object to be negative
10. High-light light () makes the object appear black
11. Mask Mask (color= color) 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.


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.