Cari di JavaScript 
    JavaScript Manual
Daftar Isi
(Sebelumnya) onMouseDown, onMouseMove, onMo ...Chapter 10. LiveWire Database ... (Berikutnya)

onMove

Executes JavaScript code when a move event occurs; that is, when the user or script moves a window or frame.

Event handler for

Window

Implemented in

Navigator 4.0

Syntax

onMove="handlerText"

Parameters

handlerText
JavaScript code or a call to a JavaScript function.

Event properties used

type 
Indicates the type of event.

target 
Indicates the object to which the event was originally sent.

screenX, screenY 
Represent the position of the top-left corner of the window or frame.

See also

For general information on event handlers, see "General Information about Events".

For information about the event object, see event.


onReset

Executes JavaScript code when a reset event occurs; that is, when a user resets a form (clicks a Reset button).

Event handler for

Form

Implemented in

Navigator 3.0

Syntax

onReset="handlerText"

Parameters

handlerText
JavaScript code or a call to a JavaScript function.

Examples

The following example displays a Text object with the default value "CA" and a reset button. If the user types a state abbreviation in the Text object and then clicks the reset button, the original value of "CA" is restored. The form's onReset event handler displays a message indicating that defaults have been restored.

<FORM NAME="form1" onReset="alert('Defaults have been restored.')">
State:
<INPUT TYPE="text" NAME="state" VALUE="CA" SIZE="2"><P>
<INPUT TYPE="reset" VALUE="Clear Form" NAME="reset1">
</FORM>

Event properties used

type
Indicates the type of event.

target
Indicates the object to which the event was originally sent.

See also

Form.reset, Reset

For general information on event handlers, see "General Information about Events".

For information about the event object, see event.


onResize

Executes JavaScript code when a resize event occurs; that is, when a user or script resizes a window or frame.

Event handler for

Window

Implemented in

Navigator 4.0

Syntax

onResize="handlerText"

Parameters

handlerText
JavaScript code or a call to a JavaScript function.

Event properties used

type
Indicates the type of event.

target
Indicates the object to which the event was originally sent.

width, height
Represent the width and height of the window or frame.

Description

This event is sent after HTML layout completes within the new window inner dimensions. This allows positioned elements and named anchors to have their final sizes and locations queried, image SRC properties can be restored dynamically, and so on.

See also

For general information on event handlers, see "General Information about Events".

For information about the event object, see event.


onSelect

Executes JavaScript code when a select event occurs; that is, when a user selects some of the text within a text or textarea field.

Event handler for

Text, Textarea

Implemented in

Navigator 2.0

Syntax

onSelect="handlerText"

Parameters

handlerText
JavaScript code or a call to a JavaScript function.

Event properties used

type
Indicates the type of event.

target
Indicates the object to which the event was originally sent.

Examples

The following example uses onSelect in the valueField Text object to call the selectState function.

<INPUT TYPE="text" VALUE="" NAME="valueField" onSelect="selectState()">

See also

For general information on event handlers, see "General Information about Events".

For information about the event object, see event.


onSubmit

Executes JavaScript code when a submit event occurs; that is, when a user submits a form.

Event handler for

Form

Implemented in

Navigator 2.0

Syntax

onSubmit="handlerText"

Parameters

handlerText
JavaScript code or a call to a JavaScript function.

Security

Navigator 4.0: Submitting a form to a mailto: or news: URL requires the UniversalSendMail privilege. For information on security in Navigator 4.0, see Chapter 7, "JavaScript Security," in the JavaScript Guide.

Description

You can use onSubmit to prevent a form from being submitted; to do so, put a return statement that returns false in the event handler. Any other returned value lets the form submit. If you omit the return statement, the form is submitted.

Event properties used

type
Indicates the type of event.

target
Indicates the object to which the event was originally sent.

Examples

In the following example, onSubmit calls the validate function to evaluate the data being submitted. If the data is valid, the form is submitted; otherwise, the form is not submitted.

<FORM onSubmit="return validate(this)">
...
</FORM>
See also the examples for Form.

See also

Submit, Form.submit

For general information on event handlers, see "General Information about Events".

For information about the event object, see event.


onUnload

Executes JavaScript code when an unload event occurs; that is, when the user exits a document.

Event handler for

Window

Implemented in

Navigator 2.0

Syntax

onUnload="handlerText"

Parameters

handlerText
JavaScript code or a call to a JavaScript function.

Description

Use onUnload within either the BODY or the FRAMESET tag, for example, <BODY onUnload="...">.

In a frameset and frame relationship, an onUnload event within a frame (placed in the BODY tag) occurs before an onUnload event within the frameset (placed in the FRAMESET tag).

Event properties used

type
Indicates the type of event.

target
Indicates the object to which the event was originally sent.

Examples

In the following example, onUnload calls the cleanUp function to perform some shutdown processing when the user exits a Web page:

<BODY onUnload="cleanUp()">

See also

onLoad

For general information on event handlers, see "General Information about Events".

For information about the event object, see event.

(Sebelumnya) onMouseDown, onMouseMove, onMo ...Chapter 10. LiveWire Database ... (Berikutnya)