Location.search的定义和用法:
search属性是一个可读可写的字符串,可设置或返回当前URL的查询部分(问号?及其之后的部分)
实例
返回URL的查询部分。假设当前的URL就是
http://www.runoob.com/submit.htm?email=someone@ example.com
<script>
document.write(location.search);
</script>
返回的结果为:
?email=someone@example.com
本文介绍了JavaScript中location.search属性的使用方法,该属性用于获取或设置当前URL的查询部分(即问号?及其后的部分)。通过一个具体示例,展示了如何使用document.write(location.search)来输出当前页面URL的查询字符串。
6715

被折叠的 条评论
为什么被折叠?



