HTML文档中用JavaScript调用Microsoft Agent的COM接口编程
试试下面的代码,看看有什么效果:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 2</title>
</head>
<OBJECT id=yuzi classid=CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F width="32" height="32"></OBJECT>
<SCRIPT>
var MerlinID;
var MerlinACS;
yuzi.Connected = true;
MerlinLoaded = LoadLocalAgent(MerlinID, MerlinACS);
Merlin = yuzi.Characters.Character(MerlinID);
Merlin.Show();
Merlin.Play("Surprised");
Merlin.Speak("欢迎来到我的家");
Merlin.Play("GestureLeft");
Merlin.Think("这是一个个人站点");
Merlin.Play("Pleased");
Merlin.Think("希望能给你带来一些方便与快乐");
Merlin.Play("GestureDown");
Merlin.Speak("谢谢光临!请以后常来!");
Merlin.Hide();
function LoadLocalAgent(CharID, CharACS) {
LoadReq = yuzi.Characters.Load(CharID, CharACS);
return(true);
}
</SCRIPT>
<body>
</body>
</html>