你可以用location.search来获取发?后面的字符串(包括?),至于要得到name的值就需要你自己写个函数来取得了,就好像要取得cookie的值那样,JS不能像ASP那样简单取得相关的值,都是要自己写出相应的函数!

解决方案 »

  1.   

    <% 
    变量
    temp1 = request.querystring("id")
    temp2 = request.querystring("name")
    %>
    <html><head></head>
    <body>
    <form name="form1">
    <input type=hidden name=var1 value="<%=temp1%>">
    <input type=hidden name=var2 value="<%=temp2%>">
    </form>
    <script language="javascript">
    <!--
    alert(form1.var1.value);
    alert(form1.var2.value);
    -->
    </script>
    </body>
    </html>另存为*.asp就可以了
      

  2.   

    wzcxz(天晴了) 你可能回错我的意思了
    danky()我也不是用在IE平台上的,location不是合法对象
    我的意思就是用cscript或者wscript来运行JS或者vbs脚本,但是怎么把数据传递给脚本呢?
    比如这样一个js脚本
    var name = ......//这就是传递来的数据
    wscript.echo(name)这样写的话,cscript应该怎么传递数据给脚本?我用cscript test.js?id=1这样的方式,cscript执行时说扩展名未知
      

  3.   

    wsh脚本不是这样传参数的。  ?id=1这是网页传参数的方式呀应该这样传
    test.jsobjArgs = WScript.Arguments;
    for (i = 0; i < objArgs.length; i++){
       WScript.Echo(objArgs(i));
    }cscript test.js 1 2 3 "5" "hello world"可以同时传很多个,但是不能超过256个,命令行的限制
      

  4.   

    到这里拿分
    http://expert.csdn.net/Expert/topic/1468/1468035.xml?temp=.1145288