1. 在ActiveX中添加一个公开的方法,如下:
public void ShowMessage(string msg)
{
if(msg != null)
{
MessageBox.Show(msg);
}
}
{
if(msg != null)
{
MessageBox.Show(msg);
}
}
2. HTML代码中这样使用,当然也可以在JavaScript中去使用:
<body bgcolor=’#223344’>
<object id="helloworld"
classid="clsid:9551B223-6188-4387-B293-C7D9D8173E3A" Width="184" Height="96">
</object><br>
<input type=’button’ οnclick=’helloworld.ShowMessage(“Hello World!”)’ value=’Click’>
</body>
<object id="helloworld"
classid="clsid:9551B223-6188-4387-B293-C7D9D8173E3A" Width="184" Height="96">
</object><br>
<input type=’button’ οnclick=’helloworld.ShowMessage(“Hello World!”)’ value=’Click’>
</body>