Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

fireEvent method

Fires a specified event on the object.

Syntax

object.fireEvent(bstrEventName, pvarEventObject, pfCancelled)

Parameters

bstrEventName [in]

Type: String

String that specifies the name of the event to fire.

pvarEventObject [in, optional]
C++Pointer to a Variant that specifies the IHTMLEventObj interface from which the event properties are obtained.
JavaScriptObject that specifies the event object from which to obtain event object properties.
pfCancelled [out, retval]

true (true)

Event fired successfully.

false (false)

Event was canceled.

C++Boolean that receives one of the following values:
JavaScriptBoolean. Returns one of the following values:

Return value

Type: Boolean

true

Event fired successfully.

false

Event was canceled.

Boolean. Returns one of the following values:Boolean that receives one of the following values:

Standards information

There are no standards that apply here.

Remarks

If the event being fired cannot be canceled, fireEvent always returns VARIANT_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
cancelBubble false
returnValue true
srcElement element on which the event is fired
type name of the event that is fired

 

Examples

The following sample shows how to use the fireEvent method.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/fireEventEX1.htm


<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" onmouseover="fnFireEvents();">
    Mouse over this! </div>
<p><button id="oButton" onclick="this.innerText='I have been clicked!'">Button
</button></p>
</body>
</html>

See also

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=email
input type=file
input type=hidden
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
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
createEventObject

 

 

Show:
© 2014 Microsoft