Html调用第三方组件
调用第三方组件的格式基本都是通过<OBJECT></OBJECT>节点引用对象,用Id标识,然后在脚本中使用对象的方法和属性。
1. vbscript调用组件方法
<OBJECT id=DCellWeb1 style="LEFT: 0px; WIDTH: 0px; TOP: 0px; HEIGHT: 0px"
classid=clsid:7CDB6D1E-CD4A-47B4-BFD0-310B66089007>
</OBJECT>
<SCRIPT LANGUAGE="vbscript">
<!--连接-->
Sub button1_onclick
Dim vSign
vSign=DCellWeb1.PConnect
if vSign=1 then
Text1.Value="连接成功"
else
Text1.Value="连接失败"
end if
End Sub
<!--断开-->
Sub button2_onclick
DCellWeb1.PDisConnect
End Sub
2. javascript调用组件方法
<html>
<headid="Head1"runat="server">
<title>TooBar</title>
</head>
<body>
<formid="form1"runat="server">
<imgid="emotion"src="../img/emotion.gif"title="表情"alt="" onclick="popupwnd();"
/>
</form>
<objectid="TestObj"classid="clsid: 7CDB6D1E-CD4A-47B4-BFD0-310B66089007">
</object>
<xmlid="Emotion">...</xml>
<scriptlanguage="javascript"type="text/javascript">
function popupwnd() {
var obj = TestObj.Me;
var str = Emotion.XMLDocument.xml;//用Id获取节点
window.external.CreateWnd(str, obj, 100, 200);
}
</script>
</body>
</html>
3. javascript调用IEPlus
自行写一个IEPlus组件,然后在html中使用
1) 安装ieplus(写入注册表)
2) 加入以下节点到html页面
<objectid="ieplus"classid="CLSID:7A2F9C1B-50A2-99A3-894D-ADB58FCB0A1E">
</object>
3) 注册点击事件
<input type="button"onclick="submit()"id="bSubmit"value="submit"/>
4) ieplus接口调用
function submit() {
var strxml = '…';
var obj = ieplus.AddNode(strxml);
}
<html>
<head>
<title>IEplus测试</title>
</head>
<body>
<objectid="IEPlus"classid="CLSID:7A2F9C1B-50A2-99A3-894D-ADB58FCB0A1E">
</object>
<input type="button"onclick="submit()"id="bSubmit"value="插件测试"/>
<scripttype="text/javascript">
function submit() {
var strxml = '<UIScript><Window><Node Name="vd" ID="splitter" Style="1" Rows="2" Cols="1" Height="159,354," Width="200,300," Hmin="150" rgbLeftTop="RGB(0,255,128)" rgbRightBottom="RGB(0,128,128)" MiddleColor="RGB(0,128,128)"></Node></Window></UIScript> ';
var obj = IEPlus.AddNode(strxml);
}
</script>
</body>
</html>