<script language="javascript" defer>

解决方案 »

  1.   

    还是有问题,发出:object variable or with block variable not set 的错误.
      

  2.   

    <HEAD>
    <TITLE>yourProject.CAB</TITLE>
    </HEAD>
    <BODY>
    <OBJECT ID="yourClass"
    CLASSID="CLSID:5FFAC337-4F98-4492-AFB0-07E32753739B"
    CODEBASE="yourProject.CAB#version=1,0,0,0">
    </OBJECT>
    <script language="javascript">
      yourClass.DrawHTML();
    </script>
    </BODY>
    </HTML>
    这样试试看,在运行yourClass.DrawHTML();之前必须存在yourClass,如果放在前面了,还不存在yourClass,所以提示“对象yourClass不存在”
      

  3.   

    我这样做了,但发生:object variable or with block variable not set 的错误.
      

  4.   

    vb下的dlls的代码:
      Private oResponse     As Response       'refrences   the   response   object   created   by   IIS
      Private oRequest     As Request         'refrences   the   request   object   created   by   IIS
      Private oSession     As Session             'this   refrence   is   optional   and   handy   for   people   who   like   to   use   session   var
        
      Public Property Set Response(vData As Response)               '   these   parameters   could   be   set   by   passing
                                                                                                      'them   to   an   altered   DrawHTML   sub
              Set oResponse = vData
      End Property
        
      Public Property Set Session(vData As Session)
              Set oSession = vData
      End Property
        
      Public Property Set Request(vData As Request)
              Set oRequest = vData
      End Property
        
      Public Sub DrawHTML()
      Dim strHTML     As String
        
      strHTML = "<HTML><HEAD></HEAD>" & vbCrLf               'vbcrlf   is   for   easier   HTML   source   code   reading   from   the   browser,   which   i   do   alot   of   when   debuging   javascript   sent   from   COM
      strHTML = strHTML & "<body   bgcolor=#ccccc>" & vbCrLf               'NOTE:   lots   of   string   building   like   this   can   be   very   slow   in   VB
      strHTML = strHTML & "This   text   is   coming   from   a   COM   <br>" & vbCrLf
      strHTML = strHTML & "object   via   references   to   the   ASP   <br>" & vbCrLf
      strHTML = strHTML & "intrinsic   objects,   rather   than   using   <br>" & vbCrLf
      strHTML = strHTML & "WebClasses(IIS   application)."
        
      oResponse.Write strHTML       '   and   finally   send   the   string
      'i   didnt   need   to   do   the   concatenation   like   that   for   a   short   paragraph   but   i   did
      'because   normally   I   am   using   logic   and   subclasses   to   build   parts   of   HTML,
      'with   database   entries,   etc.
        
      'one   issue   with   building   HTML   is   you   end   up   doing   ALOT   of   string   concatenation
      'Ive   read   that   multiple   string   concatenation   can   be   a   VERY   serious   problem   in   VB
      'I   would   recommend   searching   the   web   for   a   more   efficient   third   party   routine
      'to   do   this   if   you   notice   performance   problems   with   string   manipulation
      End Sub
      

  5.   

    呵呵,做过Delphi的,没有做过VB的