HTML DOM search 屬性
定義和用法
search 屬性是一個(gè)可讀可寫(xiě)的字符串,可設(shè)置或返回當(dāng)前 URL 的查詢部分(問(wèn)號(hào) ? 之后的部分)。
語(yǔ)法
location.search=path_from_questionmark
實(shí)例
假設(shè)當(dāng)前的 URL 是: http://www.w3school.com.cn/tiy/t.asp?f=hdom_loc_search
<html>
<body>
<script type="text/javascript">
document.write(location.protocol
);
</script>
</body>
</html>
輸出:
?f=hdom_loc_search