where are you running the code? try the following on the client side:<script language="vbscript">
set sc = CreateObject("ScriptControl")
sc.Language="JScript"
sc.AddObject "window",window
sc.Eval ("window.alert('hello')")
</script>

解决方案 »

  1.   

    <script language="vbscript">
    execScript "alert('hehe')","javascript"
    </script>
      

  2.   

    alert不是JScript的东西哦
    如果你在VB中调用alert当然出错。和saucer(思归) 写的一样。你在VB中可以这样:
    Private Sub Form_Load()
        Dim SC
        Set SC = CreateObject("ScriptControl")
        SC.Language = "JScript"
        SC.AddObject "form", Me
        SC.Eval ("form.Caption=""Welcome"";")
    End Sub
      

  3.   

    我是要在ActiveX中调用脚本(VBScript或JScript),在嵌入网页中执行时,好像是ActiveX对脚本进行解释,他无法识别“alert”、“window”、“document”等对象,不知各位大侠有何良策???
      

  4.   

    晕。。
    你是想做个控件放到HTML中吧?
    <object id=myobj classid=...></object>
    这个?
    然后你想在那ActiveX中控制window?
    方法很简单哦
    暴露 obj.Init(/*[in]*/IDispWindow)
    然后
    在HTML的脚本中调用
    myobj.Init(window)
    就把window传进去了。。不过window并不是默认的空间对象。所以在内部,你也只能用window.alert
    而不能用alert
      

  5.   

    JScript没有了IE的背景,可能会变成了跟Windows Script Host一样了吧
    不妨试一下WScript.Echo("aaaa");
      

  6.   

    晕。。WScript是WSH专有的。。试试这个:
    1