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; }
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; }
“http://seafox.myrice.com/a.asp?id=5&class=d”
“SFM(冰人)”指的是:“?id=5&class=d”吗?“岩石心灵”:从网上保存下来的网页,alert出来后是空的!
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;
}
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;
}
<a href="http://localhost/web.asp?a=1&b=2"></a>会得到'a=1&b=2'