window.location.search 是文件名后面URL部份,,包括"?",,

解决方案 »

  1.   

    能说清楚点吗?
    “http://seafox.myrice.com/a.asp?id=5&class=d”
    “SFM(冰人)”指的是:“?id=5&class=d”吗?“岩石心灵”:从网上保存下来的网页,alert出来后是空的!
      

  2.   

    Sets or retrieves the substring of the href property that follows the question . SyntaxHTML N/A 
    Scripting object.search [ = sSearch ] Possible ValuessSearch String that specifies or receives the substring of the href property. The property is read/write. The property has no default value.Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see Dynamic Properties.
    ResThe substring that follows the question  is the query string or form datafunction getSearch()
    {
        return document.location.search;
    }
      

  3.   

    SyntaxHTML N/A 
    Scripting object.search [ = sSearch ] Possible ValuessSearch String that specifies or receives the substring of the href property. The property is read/write. The property has no default value.Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see Dynamic Properties.ResThe substring that follows the question  is the query string or form data.ExampleThis example function returns the search property of the current page location.function getSearch()
    {
        return document.location.search;
    }
      

  4.   

    得到href属性中,'?'后面的部分。
    <a href="http://localhost/web.asp?a=1&b=2"></a>会得到'a=1&b=2'