我用Delphi6的ActiveForm向导编了一个ocx控件,在里面写了一个很简单的函数。但是在Html里用javascript调用ocx里的函数,提示“网页上有错误”。用ocx界面上的操作都正常。是不是我写的函数放的位置不对,还是javascript里面的代码不对。现上传源码,望各位好心的高手多帮忙,谢谢!
网页代码如下:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>CardRead Test</title>
<script anguage="javascript">function ShowOK(){
         var my_id = 0;
my_id = My.My_RCard();
alert("调用成功");
}</script></head><body><OBJECTid = "My"
  classid="clsid:0228C88D-DC7D-4825-B6A1-01974299FF21"
  codebase="http://LENEVER/ActiveFormProj1.ocx#version=1,0,0,0"
  width=343
  height=27
  align=center
  hspace=0
  vspace=0
>
</OBJECT><input name="Submit11" type="button" onclick=ShowOK() value="跳出OK对话框"></body></html>Delphi 6 代码如下:unit ActiveFormImpl1;{$WARN SYMBOL_PLATFORM OFF}interfaceuses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ActiveX, AxCtrls, ActiveFormProj1_TLB, StdVcl, StdCtrls;type
  TActiveFormX = class(TActiveForm, IActiveFormX)
    Button1: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
    function My_RCard(): Integer;
  private
    { Private declarations }
     ...//...表向导自动生成的代码
  protected
    { Protected declarations }
    ...//...表向导自动生成的代码
  public
    { Public declarations }
    ...//...表向导自动生成的代码
  end;
  ...
//下面的函数是我自己写的
function TActiveFormX.My_RCard(): Integer;
var
  retv:integer ;
begin
  Result:= -1;
  ShowMessage('OK');
  Result:= retv;
end;procedure TActiveFormX.Button1Click(Sender: TObject);
begin
  ShowMessage('OK');
end;另外,象IIS等其它设置都正常。