http://www.51windows.net/hw/asp/jsview.asp?id=299

解决方案 »

  1.   

    <BODY>
    <button onclick='alert(location.search.substr(1).split("?"));'>?</button>
    </BODY>
      

  2.   

    demo.htm<a href="aa.htm?action=y">Test</a>aa.htm<script>
    function getvalue() {
    var locationhref=document.location.href;
    var s=locationhref.split("?");
    var s1=s[1].split("=");
    alert(s1[0]+"="+s1[1]);
    }
    </script>
    <body onload="getvalue()">
    ok
    </body>
      

  3.   

    js本身不能接受?形式的参数比如说aaa.js?type=text你的意思是这样的吧??它只能解析从url来的字串,提出参数
      

  4.   

    <script>
    function QueryString(item){
    var sValue=location.search.match(new RegExp("[\?\&]"+item+"=([^\&]*)(\&?)","i"))
    return sValue?sValue[1]:sValue
    }
    alert(QueryString("id"))
    </script>