躺在沙滩上的小猪

快乐的每一天

fireEvent Method

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/fireevent.asp

Fires a specified event on the object.

Syntax

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

Parameters
sEventRequired. String that specifies the name of the event to fire.
oEventObjectOptional. 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

<html>
<head>
    
<script>
        
function fnfireevents()
        {
            odiv.innertext 
= " the cursor has moved over me! ";
            obutton.fireevent(
" onclick ");
        }
    
</script>
</head>

<body>
<h1> using the fireevent method </h1>
by moving the cursor over the div 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>
</body>
</html>  

posted on 2006-05-05 12:53 martin xus 阅读(273) 评论(0)  编辑  收藏