

var p=0
function switchSysBar()
{
if(p==0)
{
switchPoint.innerHTML="<img src=/myimages/1/toggler_1.gif>"
document.all("frmTitle").style.display="none"
p=1
}
else
{
switchPoint.innerHTML="<img src=/myimages/1/toggler_2.gif>"
document.all("frmTitle").style.display=""
p=0
}
}
function SetCwinHeight(){
var iframeid=document.getElementById("frmright"); //iframe id
if (document.getElementById){
if (iframeid && !window.opera){
if (iframeid.contentDocument && iframeid.contentDocument.body.offsetHeight){
iframeid.height = iframeid.contentDocument.body.offsetHeight;
}else if(iframeid.Document && iframeid.Document.body.scrollHeight){
iframeid.height = iframeid.Document.body.scrollHeight;
}
}
}
}
function switchSysBar()
{
if(p==0)
{
switchPoint.innerHTML="<img src=/myimages/1/toggler_1.gif>"
document.all("frmTitle").style.display="none"
p=1
}
else
{
switchPoint.innerHTML="<img src=/myimages/1/toggler_2.gif>"
document.all("frmTitle").style.display=""
p=0
}
}
function SetCwinHeight(){
var iframeid=document.getElementById("frmright"); //iframe id
if (document.getElementById){
if (iframeid && !window.opera){
if (iframeid.contentDocument && iframeid.contentDocument.body.offsetHeight){
iframeid.height = iframeid.contentDocument.body.offsetHeight;
}else if(iframeid.Document && iframeid.Document.body.scrollHeight){
iframeid.height = iframeid.Document.body.scrollHeight;
}
}
}
}
本文介绍了一个使用JavaScript实现的页面标题栏显示隐藏切换功能及iframe自适应高度的方法。通过修改变量p的值来控制标题栏的显示与隐藏,并使用不同的条件判断语句确保iframe能够根据其内容高度自动调整。
868

被折叠的 条评论
为什么被折叠?



