偶在delphi中用 建立一个ActiveX工程
添加一个ActiveX Control,添加一个Automation Object
在Type Library中添加一个Method1的方法procedure TActiveFormX.Method1;
begin
ShowMessage('123');
end;
生成一个ocx,然后用windows的iexpress打包成一个cab文件建立一个html页面
用如下代码调用<HTML>
<script language="javascript">
function aa()
{
alert(document.act.Method1);
}
</script>
<H1> Delphi 6 ActiveX Test Page </H1><p>
You should see your Delphi 6 forms or controls embedded in the form below.
<HR><center><P>
<OBJECT
classid="clsid:1C31FE0A-23BC-4735-A393-DA221AFE52F4"
codebase="123.cab#version=1,0,0,0"
width=538
height=350
align=center
hspace=0
vspace=0
id="act"
>
</OBJECT><br><input type="button" onClick="aa()" value="click2"/>
</HTML>页面按钮单击后总是显示undefined(没有定义)
请各位大侠指点指点,偶想用Activex控件在页面返回指定的字符串,不知道以上做法是否正确?
添加一个ActiveX Control,添加一个Automation Object
在Type Library中添加一个Method1的方法procedure TActiveFormX.Method1;
begin
ShowMessage('123');
end;
生成一个ocx,然后用windows的iexpress打包成一个cab文件建立一个html页面
用如下代码调用<HTML>
<script language="javascript">
function aa()
{
alert(document.act.Method1);
}
</script>
<H1> Delphi 6 ActiveX Test Page </H1><p>
You should see your Delphi 6 forms or controls embedded in the form below.
<HR><center><P>
<OBJECT
classid="clsid:1C31FE0A-23BC-4735-A393-DA221AFE52F4"
codebase="123.cab#version=1,0,0,0"
width=538
height=350
align=center
hspace=0
vspace=0
id="act"
>
</OBJECT><br><input type="button" onClick="aa()" value="click2"/>
</HTML>页面按钮单击后总是显示undefined(没有定义)
请各位大侠指点指点,偶想用Activex控件在页面返回指定的字符串,不知道以上做法是否正确?
TestFunc.Foo()</script>
{
alert(document.act.Method1); //这个是错的。改为:act.Method1();
}
alert(document.act.Method1);
变为
document.act.Method1();