在表格里用iframe插入另一个网页内容(b.asp.html),并用scrolling="no"不显示滚动条,在网上找了好多方法结果都不能成功。有些在firefox浏览器里成功但是IE里又显示不完全,比如以下代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>injection_iframefile</title>
</head>
<!--<body>-->
<script type="text/javascript">
function turnHeight(iframe)
{
var frm = document.getElementById(iframe);
var subWeb = document.frames ? document.frames[iframe].document : frm.contentDocument;
if(frm != null && subWeb != null)
{ frm.height = subWeb.body.scrollHeight + 20;}
}
</script>
<iframe id="iframe1" src="b.asp.html" onload="turnHeight('iframe1');" scrolling="no" width="101%" frameborder="0" height="100%"></iframe>
<noscript> <!--/body--></noscript>
</html>请热心朋友指导,先谢谢了!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>injection_iframefile</title>
</head>
<!--<body>-->
<script type="text/javascript">
function turnHeight(iframe)
{
var frm = document.getElementById(iframe);
var subWeb = document.frames ? document.frames[iframe].document : frm.contentDocument;
if(frm != null && subWeb != null)
{ frm.height = subWeb.body.scrollHeight + 20;}
}
</script>
<iframe id="iframe1" src="b.asp.html" onload="turnHeight('iframe1');" scrolling="no" width="101%" frameborder="0" height="100%"></iframe>
<noscript> <!--/body--></noscript>
</html>请热心朋友指导,先谢谢了!
function SetCwinHeight(obj)
{
var cwin=obj;
if (document.getElementById)
{
if (cwin && !window.opera)
{
if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight)
cwin.height = cwin.contentDocument.body.offsetHeight; //FF NS
else if(cwin.Document && cwin.Document.body.scrollHeight)
cwin.height = cwin.Document.body.scrollHeight;//IE
}
else
{
if(cwin.contentWindow.document && cwin.contentWindow.document.body.scrollHeight)
cwin.height = cwin.contentWindow.document.body.scrollHeight;//Opera
}
}
}
</script>
<iframe id="iframe1" src="b.asp.html" onload="SetCwinHeight(this)" scrolling="no" width="101%" frameborder="0" height="100%"></iframe>