iframe的display:block;border:0px即可觖决底部留白
高度自动大小
function changeFrameHeight(){
var ifm= document.getElementById("mainiframe");
ifm.height=document.documentElement.clientHeight-50;
}
window.οnresize=function(){ changeFrameHeight();} $(function(){changeFrameHeight();});
修改src后页面又回来问题:将a的href改为href="#"
获取URL
window.parent.document.getElementById("iframe").contentWindow.location.search; //需要iframe的ID
function geturl(name) {
var reg = new RegExp("[^\?&]?" + encodeURI(name) + "=[^&]+");
var arr = window.parent.document.getElementById("Ateon-SetParent-iframe").contentWindow.location.search.match(reg);
if (arr != null) {
return decodeURI(arr[0].substring(arr[0].search("=") + 1));
}
return "";
}