<script language=vbs>
function vbs()
MsgBox "vbs"
end function
</script><script language=javascript>
function(){
alert("123");
vbs()
}
</script>请问这样可以调用吗?JavaScriptVBScript函数HTML

解决方案 »

  1.   

    不行啊,所以看是不是哪里写错了,巨硕非ie内核浏览器不支持vbs,但可以在服务器段调用,不知道怎么写啊
      

  2.   

    <%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <script language="VBSCRIPT">
    function vbs()
    MsgBox "vbs"
    end function
    </script>
     
    <script language="javascript">
    function(){alert("123");vbs()}
    </script>
    </body>
    </html>在IE中也没有结果啊
      

  3.   

    你要这么写
    <script language="javascript">
    function xx(){ 
    alert("123"); 
    vbs() 
    }
    xx()
    </script>
      

  4.   

    或者
    <script language="javascript">
    (function(){ 
    alert("123"); 
    vbs() 
    })()
    </script>
      

  5.   

    请问版主:如果vbscript函数是在服务器端,可以调用吗?比如:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <%
    function vbs()
    if ...
    then...
    end if
    end function
    %> 
    <script language="javascript">
    (function(){ 
    alert("123"); 
    vbs() 
    })()
    </script>
    </body>
    </html>
      

  6.   

    response.write("<script language="javascript">")
    response.write("(function(){alert("123"); vbs() })()")
    response.write("</script>")或者javascript函数用服务端输出,不知是否可以这样
      

  7.   

    都在服务器端也是可以调用的,但需要加
    <script language="javascript" runat=server>但服务器端需要注意不能使用alert了。输出内容使用Respose.Write()
    另外注意js是区分大小写的
      

  8.   

    <%
    function vbs()
    if True Then
    vbs="AAA"
    Else
    vbs="BBB"
    end if
    end function
    %>
    js显示的话,需要写客户端的js如<script language="javascript">
    (function(){ 
    alert("123"); 
    alert("<%=vbs%>")
    })()
    </script>
      

  9.   

    那类似<script language="javascript">
    (function(){ 
    alert("123"); 
    vbs() 
    })()
    </script>
    还要改成
    response.write("<script language="javascript">")
    response.write("(function(){alert("123"); vbs() })()")
    response.write("</script>")
    吗,应该没关系吧,反正是客户端,只要vbscript函数写进服务器端
      

  10.   

    那类似<script language="javascript">
    (function(){ 
    alert("123"); 
    vbs() 
    })()
    </script>
    还要改成
    response.write("<script language="javascript">")
    response.write("(function(){alert("123"); vbs() })()")
    response.write("</script>")
    吗,应该没关系吧,反正是客户端,只要vbscript函数写进服务器端好像看错了,哈哈,都要写进服务器端