JS标签获取另一个页面传过来的href值

a href=b.html?id=楼主>B页面</a>
b.html中的获取函数:
function getParam(){
C1=window.location.href.split("?")[1]; //得到id=楼主
C2=C1.split("=")[1]; //得到楼主
alert(C1); alert(C2)}

已亲测,可行!

猜你喜欢

转载自www.cnblogs.com/share-record/p/10518621.html