Objects and properties in JavaScript Reference Script tag
Used to include JavaScript code.
Attributes
Language Definition Script Language SRC Defines a URL to specify files ending with .js.
WINDOW object
The top-level object of each HTML document.
Attributes
Frames [] submert array. Each subride is stored in the order defined in the source document. Feames.Length subrill. Self Current window. Parent Parent window (The current window is a child window). Top top window (Yes All visible windows' parent window). The message on the Status browser status window. DefaultStatus appears on the default message on the browser status window when Status is invalid. Name internal name, window opened by a Window.Open () method The name of the definition.
method
Alert ("Message") Displays the "JavaScript Alert" dialog containing a given message. Confirm ("Message) displays the" CONFIRM "dialog containing a given message (there is an OK button and a Cancel button). If the user Hit OK Returns true, otherwise returns false. Prompt ("message") Displays a "Prompt" dialog box, requiring the user to give the corresponding input according to the display message. Open ("URL", "Name") Opens a new window, give a specified The name. Close () Close the current window.
Frame Objects It is the sub-window of the entire browser window. In addition to status, defaultstatus, named, it has all the properties of the Window object. It is the sub-window of the entire browser window, except STATUS, DEFAULTSTATUS, NAME properties, it owns All properties of the Window object.
Location object
Contains information about the current URL.
Attributes
HREF's entire URL string. Protocol contains a string of the first part of the URL, such as http: Host contains a string of the host name in the URL: Port number part of the port number. Such as //www.cenpok.net/server/ hostname Contains the host name in the URL String. For example, http://www.cenpok.net port contains a port number string that may exist in the URL. The part of "/" in the PathName URL. For example, ~ list / index.htm hash "#" (CGI) The string after the parameter). String after the Search "?" (CGI parameter).
Document object
Contains the object of the current document information.
Attributes
Title Current document title, if not defined, the full url of "Untitled". Location Document contains the last modification date of the document. The ReferRerator URL, that is, which URL is linked from the current page. BGColor background color (# XXXXXX) FGColor Prospect Text Color. LinkColor Hyperlink Color. VLINKCOLOR Access the super chain color. AlinkColor activation chain color (Mouse holds down the error). The array of Form objects in the document is stored. Forms. The number of FORM objects in the Length documentation. Links [] corresponds to the array objects corresponding to all HREF chains in the document. The number of href chains in the links.length document. Anchors [] Anchor (...) array, in order Define the storage. Anchors.length document the number of anchors.
method
Write ("string") highlights the string to the current window. (String can contain HTML tags) Writeln ("String") is similar to Write (), adding a carriage return at the end, only take effect in the scheduled format text. Clear () Clear the current window. Close () Close the current window.
FORM object
Attributes
Name attribute of the name attribute in Name, the class value of the method attribute in Method, "0" = "get", "1" = "post". Action attribute string value. Target table data submitted, The corresponding attribute in the tag is consistent. Elements [index] Elements property contains individual elements in the Form. The number of elements in the LENGTH table. Method
Submit () submits the form. Event Processor OnSubmit () User Click a defined button to submit the code running when Form.
Text and Textarea objects
Attributes
Name Name Attribute string value. Value domain content string value. The initial string value of the DEFAULTVALUE domain content.
method
FOCUS () Sets the object input focus. Blur () removes the input focus on the object. Select () selects the input area of the object.
Event processor
ONFOCUS is executed when the input focus is entered. ONBLUR is executed when the domain is lost. Onsect is executed when some text in the domain is selected. ONCHANGE is executed when the domain is lost, and the domain value is executed relative to the onfocus.
Check box (checkbox)
Attributes
Name Name Attribute string value. Value check box content string value. If set, "ON", otherwise "OFF". Checked check box content of the Boolean value. If set, True is true Otherwise, for false. DefaultChecked reflects the Boolean value of the attribute (default).
method
Click () Select the check box and make the status as "on".
Event processor
OnClick is executed when a user clicks CheckBox.
Single selection button (RADIO) object
Attributes
Name Name Attribute string value. The number of radio buttons in the LENGTH Radio object. The value of the value of the value. Checked Boolean value, press True, otherwise false. defaultChecked reflects the Boolery value of the check attribute value.
method
Click () Select the radio button.
Event processor
OnClick is executed when a radio button is selected.
SELECT object
Attributes
The number of objects in the LENGTH SELECT object. Name is the internal name of the SELECT object defined by the name = property. SelectedIndex SELECT object is currently selected for Option. Options This property corresponds to the content of the flag when defining the Select object in HTML It has the following properties: text string after the text tag. The value of the value value attribute, the value is submitted when the Submit button is pressed. DefaultSelected reflects the Boolean value of the SELECTED property of the tag. SELECTED reflects the current selection status of Option Boolean value.
Event processor
ONFOCUS is executed when the input focus enters the domain. ONBLUR is executed when the domain is lost. ONCHANGE is lost when the domain is lost, and if the value of the domain changes when the value is executed, ONCHANGE is executed.
Button object
There are three types of buttons in the table, definition from the Type property in the tag: .submit (Type = "subs"). Reset (Type = "reset") .custom (type = "button")
All button objects have the following ingredients:
Attributes
Value Value Attribute string value. Name Name property of string value.
method
Click () selected button
Event processor
OnClick is executed when the button is clicked.
Submit and reset object
Attributes
Value value = content of the properties. Name name = content of the property.
method
Click () selected button
Event processor
OnClick is executed when the button is clicked.
Password object
Attributes
DefaultValue value = content of the property. Name name = content of the property. Value is currently entering the data of the Password domain. Method
FOCUS () will bring the focus into the Password domain. Blur () removes the focus from the Password domain. Select () Select the current data in the Password domain for modification.
Navigator object
This object is used to determine the Navigator version used when users are accessible.
Attributes
AppCodename relative to the actual name of the user browser. Appversion relative to the version number of the user browser. UseERAGENT This property reflects all the information of the user browser.
String object
String object provides a lot of methods for the content of the operation string.
Attributes
The length of the LENGTH string, that is, the number of characters in the string.
method
BIG (), BLINK (), Bold (), Fixed (), Italics (), SMALL (), SUB (), Strike (), SUP (), FontColor (SIZE), FONTSIZE (SIZE)
The above method adds the corresponding HTML tag. Charat (index) Returns the characters at Index in the string. Indexof (SearchValue, [fromNDEX]) This method is looking for the first appearance SearchValue in the string. If given FromNDEX, start searching from the bit in the string, returns the position of the first character of the string. LastIndexof (SearchValue, [fromNDEX]) Search from the end of the string SearchValue, and report the found An instance. Substring (Indexa, IndexB) Gets substrings from Indexa to IndexB. TOLOWERCASE (), TouPpercase () Convert all characters in the string to capital, lowercase.
Date object
To use the Date object, you must be a Date instance:
Variable name = new Date ();
method
Getday (), getDate (), gethouse (), getminutes (), getMonth (), getseconds (), gettime (), gettimezoneoffset (), getYear ()
There is a setday ... ...
Togmtstring () returns the current time with the GMT format. (Sun, 12 Feb 1999 14:19:22 GMT) Tolocalestring Returns the current time with the locale format. (03/11/99 14:19:22) Parse (Date) Putong Date The string is converted into a font form to give SetTime ().
Math object
Attributes
LN10 (10 natural logarithmic) PI (3.1415926 ...) SQRT1_2 (1/2 square root)
method
ABS (x) Returns the absolute value acOS (x) Returns the arc cosine value ASIN (X) Returns the arc SIN value atan (x) Returns the arc tangent value CEIL (X) returns the minimum integer greater than equal to X COS (X) Returns the COSINE Value Exp (X) Returns E'S Floor FLOOR (X) Returns the maximum integer log (x) equal to X Returns Max (x, y) Returns to x, y Value MIN (X, Y) Returns the small value Pow (x, y) in x, y) Returns the Y, Round (X) rounded to the nearest integer, (less than or equal to 0.5 small number) SIN (X) Returns the SIN value SQRT (x) Returns X's square root TAN (X) Returns the Tangent value of X