IT源码网

html页面之间传值问题

developer 2019年11月29日 Web前端 694 0

1.如再A页面(A.html)通过window.open(B.html?code=11)或者通过其他方式跳转到其它html页面时:

  可通过以下方式进行传递参数。

//B.html页面
function
getParameterString(paraName){ var reg = new RegExp("(^|&)"+ paraName+"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if(r!=null)return unescape(r[2]); return null; } var code = getParameterString("code");

 

评论关闭
IT源码网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!

元素隐藏的方式之hidden,display,visibility