Home > php教程 > php手册 > javascript取URL值的方法

javascript取URL值的方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:00:56
Original
946 people have browsed it

location.href='ping.html#chen=陈建平' 取锚点值 location.hash 结果是:#chen=陈建平 location.href='ping.html?chen=陈建平' 取?后面的值 location.href.search() 结果是:?chen=陈建平 再用substring(1) 就可以取#或?后的值了,再用split()方法可以把

location.href='ping.html#chen=陈建平'


取锚点值  location.hash  结果是:#chen=陈建平



location.href='ping.html?chen=陈建平'


取?后面的值  location.href.search() 结果是:?chen=陈建平


再用substring(1)  就可以取#或?后的值了,再用split()方法可以把多个参数放入数据中


var args=xx.split('&') 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template