Partilhar via


oncomplete Event

  Microsoft Speech Technologies Homepage

Occurs when prompt playback ends successfully.

>

HTML <prompt.oncomplete="eventHandler()"
JScript prompt.oncomplete = eventHandler;
Named Script <SCRIPT FOR = prompt EVENT = oncomplete>

Remarks

Although it does not receive properties directly, the event handler can query the status property of the prompt element for data about the event. When a prompt completes successfully, status is set to zero. When the Stop method is used to interrupt a prompt, the oncomplete event is not raised and the status property is unaffected.

Example

The following code demonstrates the use of the oncomplete event.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:salt="http://www.saltforum.org/2002/SALT">
  <head>
    <object id="Speechtags" CLASSID="clsid:DCF68E5B-84A1-4047-98A4-0A72276D19CC" VIEWASTEXT></object>
  </head>
    
  <body>
    <?import namespace="salt" implementation="#Speechtags" />
    <salt:prompt id="Prompt1" Speechtags="doCompleted()"></salt:prompt>
 
    <input type="button" name="BtnStart" value="Start Prompt" OnClick="StartPlayback()" id="StartBtn">

    <br><br>
    <input type="button" name="BtnStop" value="Stop Prompt" OnClick="StopPlayback()" id="StopBtn">
    
    <br><br>
    Stop Status: <input type="text" name="Status" value = "This is text to be spoken" size = "80%" id="StatusTxt">

    <script language="JScript">
    <!--
      function StartPlayback() {
        Prompt1.Start(StatusTxt.value);
      }
        
      function StopPlayback() {
        Prompt1.Stop();
      }
        
      function doCompleted() {
        StatusTxt.value = Prompt1.status;
      }

      -->
    </script>
  </body>
</html>

See Also

prompt Element |  Stop Method | status Property