Глава 40. Интерактивный Web-сайт____________________________1001

Agent.Play( "Explain");

Agent.Speak( "I boogie around the page and react to the things that you do.");

Agent.Play ( "RestPose");

Agent.Speak( "Click on the button to see for yourself.");

Agent.Play( "Explain");

// Set a timer to give the user a bit of extra help if they don't click //on the button

window.setTimeout( "MoreHelpO", 30000, "JAVASCRIPT");

function MoreHelp {

Agent.Speak( "Please, click on the button to see more of this

example.IMove your mouse pointer to the button and click.");

Agent.Play( "Explain"); ''}

function Button Click(){

// If this agent isn't active, make it so.

iff 'Agent.Active )Agent.Active= true;

// Move the agent to a random spot (kinda cute)and say one // of a handful of random phrases.

Agent.MoveTo( Math.random()* 800, Math.random()* 600, true );

Agent.Speak( "Cool!");

Agent.Play( "RestPose");

Agent.Speak( "You clicked on the button!I You did good![Click on the button again.");

Agent.Play( "Explain");

}

</SCRIPT>

<INPUT TYPE=BUTTON VALUE="Click on This"OnClick="Button_Click()">

</BODY>

</HTML>

(См. раздел "Связывание элементов управления ActiveX и скриптов"главы 22.)