www.fgks.org   »   [go: up one dir, main page]

Click to Rate and Give Feedback
Methods
 fireEvent Method
fireEvent Method

Fires a specified event on the object.

Syntax

bFired = object.fireEvent(sEvent [, oEventObject])

Parameters

sEvent Required. String that specifies the name of the event to fire.
oEventObject Optional. Object that specifies the event object from which to obtain event object properties.

Return Value

Boolean. Returns one of the following values:

trueEvent fired successfully.
falseEvent was cancelled.

Remarks

If the event being fired cannot be cancelled, fireEvent always returns true.

Regardless of their values specified in the event object, the values of the four event properties—cancelBubble, returnValue, srcElement, and type—are automatically initialized to the values shown in the following table.

Event object propertyValue
cancelBubblefalse
returnValuetrue
srcElementelement on which the event is fired
typename of the event that is fired

Example

The following sample shows how to use the fireEvent method.

<html>

<head>
<script type="text/javascript">
function fnFireEvents()
{
oDiv.innerText = "The cursor has moved over me!";
oButton.fireEvent("onclick");
}
</script>
</head>

<body>

<h1>fireEvent Method Sample</h1>
<p>By moving the cursor over the <strong>div</strong> below, the button is clicked.</p>
<div id="oDiv" >
    Mouse over this! </div>
<p><button id="oButton" >Button
</button></p>

</body>

</html>
This feature requires Microsoft® Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

There is no public standard that applies to this method.

Applies To

A, ABBR, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BDO, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, CUSTOM, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, hn, HR, HTML, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, nextID, NOBR, NOFRAMES, NOSCRIPT, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, styleSheet, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, WBR, XML, XMP

See Also

createEventObject
Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG