1、新建MFC ActiveX
2、添加方法
3.找到add函数编写代码
4、在test.idl中找到最后一个uuid
5、编译工程,会自动注册控件
6、html中的代码
<html> <head> <title>ActiveX</title> <OBJECT id="L" classid="CLSID:707431E9-43E0-4C61-8CF1-D5D83582A88D"></OBJECT> <script language="javascript"> function RunFunc() { var mm = L.add(1,1); alert(mm); } </script> </head> <body> <input id="Button1" type="button" value="121" onclick="RunFunc();" /> </body> </html>
<object classid="clsid:636B8CE1-7512-464C-B63C-FC75BDCA21DB" codebase="http://www.baidu.com" width="200" height="40" > </object>
如果对应的控件没有安装,上面语句中codebse可以指定这个文件的下载地址。
7、结果