函数是用类库的属性创建的如下
function TActiveFormX_report.Get_lnkddb(cnstr: WideString): WideString;
begin
 try
       conn.ConnectionString := cnstr;
       conn.Connected := true;
       result :='00'
 Except
        result :='-1'
         conn.Connected := false;
     
     //数据库连接失败
  End;end;
调用:
 <script language="javascript">  var OutCome1,OutCome2,OutCome3; 
  OutCome1 = document.all.ACX_Report1.LnkDB("str");  alert(OutCome1);
***************
没有显示返回值

解决方案 »

  1.   

    创建一个ActiveForm,添加Property1属性
    function TActiveFormX.Get_Property1: WideString;
    begin
      Result:='hello world';
    end;创建一个asp.net webapplication
    <%@ Page language="c#" Codebehind="WebForm2.aspx.cs" AutoEventWireup="false" Inherits="WebApplication4.WebForm2" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>WebForm2</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    <script language="javascript">
    function aaa()
    {
    alert( Form1.test1.Property1 );
    }

    </script>
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <FONT face="宋体"><INPUT style="Z-INDEX: 101; LEFT: 352px; POSITION: absolute; TOP: 120px" type="button"
    value="Button" onclick="aaa();"></FONT>
    <OBJECT id="test1" style="Z-INDEX: 102; LEFT: 136px; POSITION: absolute; TOP: 352px" classid="clsid:777CE822-D6EA-4A3C-B119-D6BAAFA781ED" VIEWASTEXT>
    <PARAM NAME="Visible" VALUE="0">
    <PARAM NAME="AutoScroll" VALUE="0">
    <PARAM NAME="AutoSize" VALUE="0">
    <PARAM NAME="AxBorderStyle" VALUE="1">
    <PARAM NAME="Caption" VALUE="ActiveFormX">
    <PARAM NAME="Color" VALUE="4278190095">
    <PARAM NAME="Font" VALUE="MS Sans Serif">
    <PARAM NAME="KeyPreview" VALUE="0">
    <PARAM NAME="PixelsPerInch" VALUE="96">
    <PARAM NAME="PrintScale" VALUE="1">
    <PARAM NAME="Scaled" VALUE="-1">
    <PARAM NAME="DropTarget" VALUE="0">
    <PARAM NAME="HelpFile" VALUE="">
    <PARAM NAME="ScreenSnap" VALUE="0">
    <PARAM NAME="SnapBuffer" VALUE="10">
    <PARAM NAME="DoubleBuffered" VALUE="0">
    <PARAM NAME="Enabled" VALUE="-1">
    <PARAM NAME="Property1" VALUE="hello world">
    </OBJECT>
    </form>
    </body>
    </HTML>
    --运行结果弹出对话框 hello world