首先,在你的主页面上必须包含以下这段javascript代码:
复制代码 代码如下:
vargetFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
//extraheightinpxtoaddtoiframeinFireFox1.0+browsers
varFFextraHeight=getFFVersion>=0.1?16:0
functiondyniframesize(iframename){
varpTar=null;
if(document.getElementById){
pTar=document.getElementById(iframename);
}
else{
eval('pTar='+iframename+';');
}
if(pTar&&!window.opera){
//beginresizingiframe
pTar.style.display="block"
if(pTar.contentDocument&&pTar.contentDocument.body.offsetHeight){
//ns6syntax
pTar.height=pTar.contentDocument.body.offsetHeight+FFextraHeight;
}
elseif(pTar.Document&&pTar.Document.body.scrollHeight){
//ie5+syntax
pTar.height=pTar.Document.body.scrollHeight;
}
}
}
然后对于主页面用到iframe的地方添加代码:
marginwidth=0marginheight=0frameborder=0
scrolling=nosrc="/myiframesrc.php"