您的位置:首页 > 其它

window.location.search

2015-07-21 11:55 218 查看
作用:取得【http://111111?A=1&B=2&C=3....】红色部分

上代码,起个名字:123.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script language="javascript">
alert(window.location.search.substr(1).split("&"));
alert(window.location.search.split('&').join('|'));
</script>
</body>
</html>


然后访问:。。。。123.html?topic=1&id=2

效果:



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: