共用方式為


onreset Event

This topic documents a feature of HTML+TIME 2.0, which is obsolete as of Windows Internet Explorer 9.

Fires when the timeline reaches the value of the BEGIN attribute or when the resetElement method is called on the element.

Syntax

Inline HTML <ELEMENT onreset = "handler(event);" >
Event Property object.onreset = handler;
attachEvent object.attachEvent( "onreset", handler);
Named script <SCRIPT FOR = object EVENT = onreset>

Event Information

Bubbles No
Cancels No
To invoke Add the time2 behavior to an element. Call the resetElement method.
Default action Calls the associated event handler.

Event Object Properties

Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query the event object for the following event properties.

Available Properties

srcElement Gets or sets the object that fired the event.
type Gets or sets the event name from the event object.

Refer to the specific event object for additional event properties.

Example

In this example, the onreset event fires when the resetElement method is called on the time container.

<HTML XMLNS:t="urn:schemas-microsoft-com:time">
<HEAD>
<TITLE>onreset Event</TITLE>

<SCRIPT>
function doReset(){
//Reset changes applied to time container.
    t1.resetElement();
    b2.disabled=true;
    b1.disabled=false;
    t1.onreset=alert('Timeline has been reset.');
}
function setEndTime(){
//Time container is set to end at 10 seconds.
    t1.endElementAt(10);
    //Has 10 seconds already lapsed within the document?
    //Yes: End time container immediately and disable buttons.
    //No: Enable reset button.
    if(document.body.currTimeState.activeTime > 10){
        alert('Time container will end immediately.');
        b2.disabled=true;
        b1.disabled=true;
    }else{
        alert('The time container will end at 10 seconds!');
        b2.disabled=false;
        b1.disabled=true;
    }
}
</SCRIPT>

<STYLE>
    .time { behavior: url(#default#time2) }
</STYLE>

<?IMPORT namespace="t" implementation="#default#time2">
</HEAD>

<BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="fixed" BGCOLOR="#FFFFFF"
    LINK="#000000" VLINK="#808080" ALINK="#000000">

<t:excl ID="t1" repeatDur="indefinite" BEGIN="0"
    onbegin="b1.disabled=false;b2.disabled=true;"> 
    <DIV ID="div1" CLASS="time" BEGIN="0" DUR="7.5s">First line displayed for
        7.5 seconds.</DIV>
    <DIV ID="div2" CLASS="time" BEGIN="5" DUR="7.5s">Second line displayed for
        7.5 seconds.</DIV>
</t:excl>

<BR>
<BUTTON id="b1" onclick="setEndTime();">End Timeline at 10 seconds</BUTTON>
<BUTTON id="b2" onclick="doReset();">Reset</BUTTON>
</BODY>
</HTML>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/onreset.htm

Applies To

t:ANIMATE, t:ANIMATECOLOR, t:ANIMATEMOTION, t:ANIMATION, t:AUDIO, t:EXCL, t:IMG, t:MEDIA, t:PAR, t:REF, t:SEQ, t:SET, time2, t:VIDEO

See Also

Introduction to HTML+TIME