JavaScript怎样调用Delphi做的ActiveX插件?(100分)

  • 主题发起人 主题发起人 sercall
  • 开始时间 开始时间
S

sercall

Unregistered / Unconfirmed
GUEST, unregistred user!
我用Delphi的ActiveForm 写了一个OCX.
在IE浏览器中怎样调用?

我现只是将OCX贴在html中:
<OBJECT
classid="clsid:9272F705-3CB3-4A29-AD91-B8FDC1576E6E"
codebase="http://100.101.102.16/temp/ActiveFormProj1.ocx#version=1,0,88,0"
width=555
height=336
align=center
hspace=0
vspace=0
>
</OBJECT>

应该怎样调用才好? 是否最好用javascript? 怎么做? 谢谢!
 
可以用以下方式
<OBJECT
classid="clsid:9272F705-3CB3-4A29-AD91-B8FDC1576E6E"
id = youcontrol
codebase="http://100.101.102.16/temp/ActiveFormProj1.ocx#version=1,0,88,0"
width=555
height=336
align=center
hspace=0
vspace=0
>
</OBJECT>
<SCRIPT LANGUAGE=javascript>
function func1()
{
youcontrol.yourfunction_in_control()
}
</SCRIPT>
 
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<META content="text/html; charset=Big5" http-equiv=Content-Type>
</HEAD>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
//硂?祘?ノㄓ簍ボ厨??ゴ?

function btnPrint_onclick() {
FileSystem1.Data=spTXT.innerText;//??txtゅン?ず甧
FileSystem1.SaveToFile("c://jswinods//preport.txt");//玂???め狠祑絃?
FileSystem1.Data=spINI.innerText;//??iniゅン?ず甧
FileSystem1.SaveToFile("c://jswinods//preport.ini");//玂???め狠祑絃?
FileSystem1.Run("c://jswinods//odsview.exe /f c://jswinods//preport.ini");//秸ノ厨?祘?
}
//-->
</SCRIPT>


<BODY>
<input type=button value="??" id=btnPrint LANGUAGE=javascript onclick="return btnPrint_onclick()">
<input type=button value="??" id=btnReBack LANGUAGE=javascript onclick="window.history.back()">
<OBJECT style="Display:none"
classid="clsid:A0551A33-9731-45E4-BE90-1DE570C15D45"
codebase="../dlls/FileSystemProj1.cab#version=1,0,2,0"
height=14 id=FileSystem1 style="HEIGHT: 14px; LEFT: 0px; TOP: 0px; WIDTH: 14px" width=14
VIEWASTEXT></OBJECT>


<span id=spINI style="Display:none">
[COMMON]<br>
IN_FILE =c:/jswinods/preport.txt<br>
IN_FORMAT =14<br>
EXECUTE =1<br>
</span>
 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>New Page 1</title>
<script language="JavaScript">
<!--
function Showmsg() {
document.all["txtNow"].value = Ax1.FNow;
document.all["txtDate"].value = Ax1.FDate;
document.all["txtTime"].value = Ax1.FTime;

var now = new Date();
var year = now.getYear();
var month = now.getMonth()+1;
var date = now.getDate();
var datestr = year+"-"+month+"-"+date;
document.all["txtDateTime"].value = datestr;
}

function SetCaption(){
Ax1.lblCaption = "SetCaption";
Ax1.FCaption = "FCaption";
}

function SetParam(){
Ax1.PassParam("1111", "2222", "string", "127");
}

function Clear(){
Ax1.Clear();
}

function GetParam(){
var pa1;
var pa2;
Ax1.OutParam(pa1, pa2);
document.all["txtParam1"].value = pa1;
document.all["txtParam2"].value = pa2;
}
//-->
</script>
</head>

<body onload="Showmsg()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#CCCCCC" rowspan="2">
<object classid="clsid:97BA702A-E192-4ADE-804C-F3B05B833ADA"
name="Ax1"
width="394"
height="256">
<param name="ButtonCaption" value="ButtonCaption">
<param name="btnCaption" value="btnCaption">
<param name="lblCaption" value="lblCaption">
<param name="FCaption" value="FCaption">
<param name="AxBorderStyle" value="0">
</object>
</td>
<td valign="top" align="center" bgcolor="#CCCC00">
<input type="text" name="txtNow" size="50">
<br>
<input type="text" name="txtDate" size="50">
<br>
<input type="text" name="txtTime" size="50">
<br>
<input type="text" name="txtDateTime" size="50">
<br>
<input type="button" name="B1" value="GetProperty" onClick="Showmsg()">
</td>
</tr>
<tr>
<td valign="top" align="center" bgcolor="#669900">
<input type="text" name="txtParam1" size="50">
<br>
<input type="text" name="txtParam2" size="50">
<br>
<input type="button" name="B2" value="GetParam" onClick="GetParam()">
</td>
</tr>
<tr align="center" bgcolor="#009999">
<td colspan="2">
<input type="button" value="SetCaption" name="B3" onClick="SetCaption()">
<input type="button" value="SetParam" name="B4" onClick="SetParam()">
<input type="button" value="Clear" name="B5" onClick="Clear()">
</td>
</tr>
</table>
</body>
</html>
 
后退
顶部