JS onclick; onmouseover onmouseout; OnMouseDown OnMouseUp Events

Source: Internet
Author: User

JS onclick; Onmouseo Tutorial ver; onmouseout; OnMouseDown OnMouseUp Events

Applets[] Java Applet Object It is an array that contains all the applet objects (Java applets) in the document. As an array, there are the properties and methods of the array. As for the properties and methods of a single Applet object, I quote: "The Applet object inherits all the 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 Methodss of the Java applet.) Because I am very disgusted with Java applet, so it's what the "public" "private" problem is not interested, there is no discussion.

Embeds[] Plug-in Object It is an array that contains all the plugins (<embed> 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 (<form>) in the document. To refer to a single form, you can use document.forms[x], but in general, people do this: add "name=" to the <form> tag, and then use the "document.< table Single-name >" To reference it directly.

The properties of the Form object

Name returns the names of the forms, which is the <form name= "..." > property.
Action Returns/sets the submission address of the form, which is the <form action= "..." > property.
method returns/sets the submission of the form, which is the <form method= "..." > property.
Target Returns/sets the window returned after the form is submitted, which is the <form target= "..." > property.
Encoding Returns/sets the encoding of the form submission, which is the <form enctype= "..." > property.
Length returns the number of elements that the form contains.

Method

Reset () resets the form. This is the same as pressing the "Reset" button.
Submit () submitting the form. This is the same as pressing the "Submit" button.

Event

OnReset; OnSubmit

The following from "button" to "Textarea" are element objects for the form.

The button buttons object is specified by the "<input type=" button ">". References a button object, you can use the < Document object >.< Form object >.< button name >. < button name > refers to the value of the "Name=" property in the <input> tag. You can use this method to refer to any form element.

Property

Name Returns/sets the element name specified with <input name= "..." >.
Value Returns/sets the values of the element specified with <input value= "..." >.
Form returns the Form object that contains this element.

Method

Blur () removes the focus from the object.
Focus () lets the object get focused.
Click () to simulate mouse clicks on the object.

Event

OnClick OnMouseDown OnMouseUp

The checkbox object is specified by the "<input type=" checkbox ">".

Property

Name Returns/sets the element name specified with <input name= "..." >.
Value Returns/sets the values of the element specified with <input value= "..." >.
Form returns the Form object that contains this element.
Checked Returns/sets whether the check box object is selected. This is a Boolean value.
Defaultchecked Returns/sets whether the CheckBox object is selected by default. This is a Boolean value.

Method

Blur () removes the focus from the object.
Focus () lets the object get focused.
Click () to simulate mouse clicks on the object.

Event

OnClick

Elements[]; Element form elements Object < Form object >.elements is an array that contains all the objects of the form. Generally we do not use the array, but directly refer to each specific object.

Hidden hidden objects are specified by the "<input type=" Hidden ">".

Property

Name Returns/sets the element name specified with <input name= "..." >.
Value Returns/sets the values of the element specified with <input value= "..." >.
Form returns the Form object that contains this element.

The Password password input area object is specified by the "<input type=" Password ">".

Property

Name Returns/sets the element name specified with <input name= "..." >.
Value Returns/sets the current value of the password input area.
DefaultValue returns the default value specified with <input value= "..." >.
Form returns the Form object that contains this element.

Method

Blur () removes the focus from the object.
Focus () lets the object get focused.
Select () selects all text in the password entry area.

Event

OnChange

The Radio radio domain object is specified by the "<input type=" Radio ">". A set of Radio objects have a common name (Name property), so that Document.formName.radioName is an array. To access a single Radio object, use: Document.formname.radioname[x].

Properties of a single Radio object

Name Returns/sets the element name specified with <input name= "..." >.
Value Returns/sets the values of the element specified with <input value= "..." >.
Form returns the Form object that contains this element.
Checked Returns/sets whether the radio domain 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 the focus from the object.
Focus () lets the object get focused.
Click () to simulate mouse clicks on the object.

Event

OnClick

The Reset button object is specified by the "<input type=" reset ">". Because Reset is also a button, there are also properties and methods for the buttons object. As for the "onclick" event, it is generally replaced by the onreset of the Form object.

The Select Select Area (Drop-down menu, List) object is specified by "<select>".

Property

Name Returns/sets the element name specified with <input name= "..." >.
Length returns the number of options under the Select object.
SelectedIndex returns the subscript for the selected option. This subscript is the position of the option in the options[] array. If the Select object allows multiple selections, the subscript for the first selected option is returned.
Form returns the Form object that contains this element.

Method

Blur () removes the focus from the object.
Focus () lets the object get focused.

Event

OnChange

Options[]; Option Select Item Object options[] is an array that contains the option object under the same select object. The Option object is specified by "<options>" under "<select>".

Options[] Array of properties

Length SelectedIndex is the same as the owning Select object's same name.

Properties of a single Option object

Text Returns/Specifies what the Option object displays
Value Returns/Specifies the values of the Option object, consistent with the <options value= "..." >.
Index returns the subscript for this Option object. There's nothing to say about it, because to specify a particular Option object, you know the object's subscript first. This property does not seem to be of any use.
Selected Returns/Specifies whether the object is selected. You can change the selected item dynamically by specifying TRUE or FALSE.
Defaultselected returns whether the object is selected by default. True/false.

The Submit Submission button object is specified by the "<input type=" Submit >. Because Submit is also a button, there are also properties and methods of the Buttons object. As for the "onclick" event, it is generally replaced by the onsubmit of the Form object.

The text box object is specified by the "<input type=" text ">". The Password object is also one of the text objects, so all properties, methods, and events for the Password object are available in the text object.

Textarea a multiline text input area object is specified by "<textarea>". The Textarea object has the same properties, methods, and events as the Text object, which is the same as the Password object.

Images[]; Image Image Object Document.images[] is an array that contains all the pictures () in the document. To refer to a single picture, you can use Document.images[x]. If a picture contains a "name" attribute, that is, ">" with "

Properties of a single Image object

Name Src LOWSRC; Width Height vspace; hspace; Border These properties are the same as those in the tag. In Netscape, in addition to the SRC attribute, other attributes (almost all) can not be changed, even if changed, in the document can not show the effect. The most useful of these properties is SRC, by assigning values to the SRC attribute, you can change the picture in real time.

Event

OnClick

An Image object that does not appear in the document

The Image object that is not displayed in the document is defined with the VAR statement:

var myimage = new Image ();
var myimage = new Image (< image address String >);

You can then treat myimage variables like a generic Image object. But since it doesn't appear in the document, the following properties: lowsrc, Width, height, vspace, hspace, border no use. Generally this object has only one use: Read-only image (preload). Because when you assign a value to the SRC attribute of an object, the entire document reads, JavaScript runs, and the browser concentrates on reading the picture. After the image is read, the browser's cache has a Copy of the picture, to the real picture in the document, the picture can be immediately displayed. Today's web pages often have some image connection, when the mouse points to it, the image replaced by another image, they are first read the image.

JavaScript examples of pre-read images

var imagepreload = new Image ();

IMAGEPRELOAD.SRC = ' 001.gif ';
IMAGEPRELOAD.SRC = ' 002.gif ';
IMAGEPRELOAD.SRC = ' 003.gif ';

The above example is suitable for pre-read a small number of pictures.

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 pre-read a large number of pictures.

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.