获取iframe src里的参数
父业面iframe:<div id="vue"><iframe id="mainiframe" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="auto" src="../swap/finance/index.html?CID=13
·
父业面iframe:
<div id="vue">
<iframe id="mainiframe" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="auto" src="../swap/finance/index.html?CID=13123jklkljlajkj"></iframe>
</div>
子页面获取src里的参数:
var headers = {}
headers.Token = GetIframeQueryString('CID', 'mainiframe')
function GetIframeQueryString (name, id) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
var r = window.parent.document.getElementById(id).contentWindow.location.search.substr(1).match(reg)
if (r != null) {
return decodeURI(r[2])
}
return null
}
更多推荐
已为社区贡献1条内容
所有评论(0)