Anchors []; Links []; link connection object
Usage: Document. Anchors[[X]]; Document. Links[[X]]; <AnchorID >;< linkid>
Document. anchors is an array that contains all the anchors (including the <A> tag of the name attribute) in the document, in the order in the document, a subscript is defined for each anchor tag starting from 0.
Document. links is also an array that contains all the connection tags in the document (including the <A> mark of the href attribute and the <area> mark in the <map> MARK segment ), in the order in the document, a subscript is defined for each connection mark starting from 0.
If a <A> tag has both the name and href attributes, it is both an anchor object and a link object.
In IE, if you add "id = "... "" attribute, the <A> object is assigned an ID. To call this object, you only need to use "<ID>. Many document parts can use this method to assign IDs, but note that there cannot be two identical IDs.
Anchors and links are used as arrays and have the attributes and methods of arrays. No attribute exists for a single anchor object. For details about attributes of a single link object, see.
attribute
protocol; hostname; port; host; pathname; hash; search; href is the same as the location object.
Target Returns/specifies the target window (string) of the connection, which is the same as the target attribute in the mark.
event
onclick; onmouseover; onmouseout; onmousedown; onmouseup
applets [] Java small Program Object is an array, contains all the applet objects in the document (Java applet ). An array has attributes and methods. For the attributes and methods of a single applet object, I reference a sentence: "The applet object inherits all the common attributes and methods of the Java Applet ." The applet object inherits all public properties of the Java applet. /the applet object inherits all public methodss of the Java Applet .) I hate Java applets, so I am not interested in any "public" or "private" issues, so I will not discuss them.
embeds [] plug-in object is an array containing all the plug-ins ( tags) in the document ). Because of the differences in each plug-in, each embed object also has different attributes and methods.
forms []; form object document. Forms [] is an array containing all forms in the document (
). To reference a single form, you can use document. forms [X], but in general, people will do this: Add "name =" in the tag "... "" attribute, then directly use "document. "can be referenced.
Form Object Attributes
NameReturns the form name, that is, the <form name = "..."> attribute.
ActionReturn/set the submission address of the form, that is, the <form action = "..."> attribute.
MethodReturns/sets the form submission method, that is, the <form method = "..."> attribute.
TargetReturn/set the window returned after the form is submitted, that is, the <form target = "..."> attribute.
EncodingReturns/sets the encoding method of the content submitted by the form, that is, the <form enctype = "..."> attribute.
LengthReturns the number of elements contained in the form.
Method
Reset ()Reset the form. This is the same as pressing the reset button.
Submit ()Submit the form. This is the same as pressing the submit button.
Event
Onreset; onsubmit
The following elements from "button" to "textarea" are form Element objects.
Button ObjectSpecified by <input type = "button">. To reference a button object, you can use "<Document Object>. <form Object>. <button name> ". <Button name> refers to the value of the "name ="... "attribute in the <input> tag. This method can be used to reference any form element.
Attribute
NameReturn/set the element name specified by <input name = "...">.
ValueReturns/sets the value of the specified element with <input value = "...">.
FormReturns the form object that contains this element.
Method
Blur ()Move the focus from the object.
Focus ()Focus on the object.
Click ()Simulate Mouse clicking on this object.
Event
Onclick; onmousedown; onmouseup
Checkbox check box objectSpecified by <input type = "checkbox">.
Attribute
NameReturn/set the element name specified by <input name = "...">.
ValueReturns/sets the value of the specified element with <input value = "...">.
FormReturns the form object that contains this element.
CheckedReturn/set whether the check box object is selected. This is a Boolean value.
DefaultcheckedReturn/set whether the check box object is selected by default. This is a Boolean value.
Method
Blur ()Move the focus from the object.
Focus ()Focus on the object.
Click ()Simulate Mouse clicking on this object.
Event
Onclick
Elements []; element form Element Object<Form Object>. elements is an array that contains all objects of the form. Generally, we do not need this array, but directly reference each specific object.
Hidden objectSpecified by <input type = "hidden">.
Attribute
NameReturn/set the element name specified by <input name = "...">.
ValueReturns/sets the value of the specified element with <input value = "...">.
FormReturns the form object that contains this element.
Password and password input area objectSpecified by <input type = "password">.
Attribute
NameReturn/set the element name specified by <input name = "...">.
ValueReturns/sets the current value of the password input area.
DefaultvalueReturn the default value specified with <input value = "...">.
FormReturns the form object that contains this element.
Method
Blur ()Move the focus from the object.
Focus ()Focus on the object.
Select ()Select all text in the password input area.
Event
Onchange
Radio single-choice domain objectSpecified by <input type = "radio">. A group of Radio objects have a common name (name attribute). In this way, document. formname. radioname becomes an array. To access a single radio object, use: Document. formname. radioname [X].
Properties of a single radio object
NameReturn/set the element name specified by <input name = "...">.
ValueReturns/sets the value of the specified element with <input value = "...">.
FormReturns the form object that contains this element.
CheckedReturns/sets whether the single-choice domain object is selected. This is a Boolean value.
DefaultcheckedReturns/sets whether the object is selected by default. This is a Boolean value.
Method
Blur ()Move the focus from the object.
Focus ()Focus on the object.
Click ()Simulate Mouse clicking on this object.
Event
Onclick
Reset reset button objectSpecified by <input type = "reset">. Because reset is also a button, attributes and methods of the button object are also available. For the "onclick" event, it is generally replaced by the onreset of the form object.
Select select area (drop-down menu, list) objectSpecified by <SELECT>.
Attribute
NameReturn/set the element name specified by <input name = "...">.
LengthReturns the number of options in the select object.
SelectedindexReturns the subscript of the selected option. This subscript is the position of this option in the options [] array. If the select object allows multiple selections, the subscript of the first selected option is returned.
FormReturns the form object that contains this element.
Method
Blur ()Move the focus from the object.
Focus ()Focus on the object.
Event
Onchange
Options []; Option select item objectOptions [] is an array that contains option objects under the same select object. The option object is specified by "<Options>" under "<SELECT>.
options [] attributes of the array
length; selectedindex is the same as that of the select object.
attributes of a single option object
text Returns/specifies the text displayed by the option object.
value Returns/specifies the value of the Option object, which is consistent with .
index returns the subscript of the Option object. There is nothing to say about this, because to specify a specific option object, you must first know the subscript of this object. This attribute seems useless.
selected Returns/specifies whether the object is selected. By specifying true or false, You can dynamically change the selected item.
defaultselected Returns whether the object is selected by default. True/false.
Submit button objectSpecified by <input type = "Submit">. Because submit is also a button, attributes and methods of the button object are also available. For the "onclick" event, it is generally replaced by the onsubmit of the form object.
Text text box objectSpecified by <input type = "text">. The password object is also a type of Text object. Therefore, all attributes, methods, and events of the password object are included in the text object.
Textarea multi-line text input area objectSpecified by <textarea>. All attributes, methods, and events of the textarea object are the same as those of the Text object, that is, they are the same as those of the password object.
Images []; image objectDocument. Images [] is an array that contains all the images in the document ( ). To reference a single image, use document. Images [X]. If an image contains the "name" attribute, that is, "
Attributes of a single image object
Name; SRC; lowsrc; width; height; vspace; hspace; Border These attributes are the same as those in the tag. In Netscape, except for the src attribute, other attributes (almost all) cannot be changed. Even if the src attribute is changed, the effect cannot be displayed in the document. The most useful of these attributes is SRC. by assigning values to the src attribute, you can change the image in real time.
Event
Onclick
Image objects not displayed in the document
The image object not displayed in the document is defined using the VaR statement:
VaR myimage = new image (); or
VaR myimage = new image (<image address string> );
Then you can treat the myimage variable like an image object. However, since it is not displayed in the document, the following attributes: lowsrc, width, height, vspace, heat ace, and border are useless. Generally, only one such object is used: preload ). When the object's src attribute is assigned a value, reading the entire document and running JavaScript are paused, allowing the browser to read the image intently. After pre-reading the image, the image copy will be available in the browser cache. when you really want to put the image in the document, the image will be immediately displayed. Currently, some images are often connected on webpages. When you point to it, the images are replaced with another one. They are pre-read images first.
Javascript example of preread Images
VaR imagepreload = new image ();
Imagepreload. src = '001.gif ';
Imagepreload. src = '002.gif ';
Imagepreload. src = '003.gif ';
The preceding example is suitable for prereading a small number of images.
Function imagepreload (){
VaR imgpreload = new image ();
For (I = 0; I <arguments. length; I ++ ){
Imgpreload. src = arguments [I];
}
}
Imagepreload('001.gif ', '002.gif', '003.gif ', '004.gif', '005.gif ');
The above example is suitable for prereading a large number of images.