Home  >  Article  >  Web Front-end  >  Other Objects in JavaScript_Basics

Other Objects in JavaScript_Basics

WBOY
WBOYOriginal
2016-05-16 19:06:38937browse

anchors[]; links[]; Link connection object
usage: document.anchors[[x]]; document.links[[x]]; ;
Document.anchors is an array , including all anchor tags in the document ( tags containing the name attribute), and a subscript is defined for each anchor tag starting from 0 according to the order in the document.
Document.links is also an array, containing all link tags in the document (including the
tag of the href attribute and the tag in the tag segment), in order in the document, starting from 0 An index is defined for each connection tag.
If a
tag has both name and href attributes, it is both an Anchor object and a Link object.
In IE, if you add the "id="..."" attribute to the
tag, the object will be assigned an identity (ID). When calling this object, you only need to use "” That’s it. Many document components can use this method to assign IDs, but be careful that no two IDs are the same.
anchors and links are arrays and have array properties and methods. A single Anchor object has no properties; the properties of a single Link object are shown below.

Attributes
protocol; hostname; port; host; pathname; hash; search; href are the same as location objects.
target returns/specifies the target window (string) of the connection, which is the same as the target attribute in the
tag.
Event
onclick; onmouseover; onmouseout; onmousedown; onmouseup

applets[] Java applet object It is an array that contains all Applet objects (Java applet) in the document. As an array, there are array properties and methods. Regarding the properties and methods of a single Applet object, I quote: "The Applet object inherits all public properties and methods of the Java applet." (English original sentence: The Applet object inherits all public properties of the Java applet./The Applet object inherits all public methods of the Java applet.) Because I hate Java applets, I am not interested in its "public" and "private" issues, so I did not discuss them.
embeds[] Plug-in object It is an array that contains all plug-ins ( tags) in the document. Because each plug-in is different, each Embed object also has different properties and methods.
forms[]; Form form object document.forms[] is an array that contains all the forms in the document (

). To reference a single form, you can use document.forms[x], but generally speaking, people will do this: add the "name="..."" attribute to the
tag, then directly use "document." can be quoted.

Attributes of the Form object
name returns the name of the form, which is the
attribute.
action returns/sets the submission address of the form, which is the
attribute.
method returns/sets the form submission method, which is the
attribute.
target returns/sets the window returned after the form is submitted, which is the
attribute.
encoding returns/sets the encoding method of form submission content, which is the
attribute.
length returns the number of elements contained in the form.
Method
reset() resets the form. This is the same as pressing the "reset" button.
submit() submits the form. This is the same as pressing the "Submit" button.
Event
onreset; onsubmit

The following from "Button" to "Textarea" are all element objects of the form.
Button button object is specified by "". To reference a Button object, you can use "..". refers to the value of the "name="..."" attribute in the tag. You can use this method to reference any form element.

Attribute
name Returns/sets the name of the element specified with .
value returns/sets the value of the element specified with .
form returns the form object containing this element.
Method
blur() removes focus from an object.
focus() gives the object focus.
click() simulates a mouse click on the object.
Event
onclick; onmousedown; onmouseup

Checkbox checkbox object specified by "".

Attribute
name Returns/sets the name of the element specified with .
value returns/sets the value of the element specified with .
form returns the form object containing this element.
checked returns/sets whether the checkbox object is checked. This is a boolean value.
defaultChecked returns/sets whether the checkbox object is checked by default. This is a boolean value.
Method
blur() removes focus from an object.
focus() gives the object focus.
click() simulates a mouse click on the object.
Event
onclick

elements[]; Element form element object .elements is an array that contains all the objects of the form. Generally we do not use this array, but directly reference each specific object.
Hidden Hidden objects are specified by "".

Attribute
name Returns/sets the name of the element specified with .
value returns/sets the value of the element specified with .
form returns the form object containing this element.

Password Password input area object is specified by "".

Attribute
name Returns/sets the name of the element specified with .
value returns/sets the current value of the password input area.
defaultValue returns the default value specified with .
form returns the form object containing this element.
Method
blur() removes focus from an object.
focus() gives the object focus.
select() selects all the text in the password input area.
Event
onchange

Radio radio field object specified by "". A group of Radio objects have a common name (name attribute), so document.formName.radioName becomes an array. To access a single Radio object use: document.formName.radioName[x].

Attributes of a single Radio object
name returns/sets the name of the element specified with .
value returns/sets the value of the element specified with .
form returns the form object containing this element.
checked returns/sets whether the radio field object is selected. This is a boolean value.
defaultChecked returns/sets whether the object is selected by default. This is a boolean value.
Method
blur() removes focus from an object.
focus() gives the object focus.
click() simulates a mouse click on the object.
Event
onclick

Reset reset button object specified by "". Because Reset is also a button, it also has properties and methods of Button objects. As for the "onclick" event, it is generally replaced by onreset of the Form object.
Select selection area (drop-down menu, list) object is specified by ".
length returns the number of options under the Select object.
selectedIndex returns the index of the selected option. This subscript is the position of the option in the options[] array. If the Select object allows multiple selections, returns the index of the first selected option.
form returns the form object containing this element.
Method
blur() removes focus from an object.
focus() gives the object focus.
Event
onchange

options[]; Option selection object options[] is an array that contains Option objects under the same Select object. Option objects are specified by ". Because Submit is also a button, it also has the properties and methods of Button object. As for the "onclick" event, it is generally replaced by onsubmit of the Form object.
Text text The box object is specified by "". The Password object is also a type of Text object, so all the properties, methods and events of the Password object are available in the Text area object. "Specify. All the properties, methods and events of the Textarea object are the same as the Text object, that is, the same as the Password object.
images[]; Image image object document.images[] is an array that contains all the images in the document (

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn