Location search 属性

定义和用法
search 属性是一个可读可写的字符串,可设置或返回当前 URL 的查询部分(问号 ? 之后的部分)。
语法
location.search
浏览器支持
所有主要浏览器都支持 search 属性
实例代码
返回URL的查询部分。假设当前的URL就是https://www.haodaima.com/submit.htm?email=someone@ example.com:
<script>
document.write(location.search);
</script>
document.write(location.search);
</script>
以上实例输出结果:
?email=someone@example.com
