有条件的话设置position:absolute 然后改z-index<iframe src="http://www.baidu.com" style="position:absolute;" id=i1></iframe>
<iframe src="http://www.google.com" style="position:absolute;" id=i2></iframe>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<INPUT TYPE="button" onclick="g()" value="shwo baidu">
<INPUT TYPE="button" onclick="b()" value="show google">
<SCRIPT LANGUAGE="JavaScript">
function g()
{
document.getElementById("i1").style.zIndex = 99
document.getElementById("i2").style.zIndex = 95
}
function b()
{
document.getElementById("i1").style.zIndex = 95
document.getElementById("i2").style.zIndex = 99
}
</SCRIPT>

解决方案 »

  1.   

    这样不行吧,我的2个iframe 最初是同时显示的,点一个链接后才一个隐藏,一个扩大上移的.
      

  2.   

    让它慢慢的上去
    <body bgcolor='black'>
    <script type='text/javascript'>function doChange() {
    var s1 = document.getElementById("ifrm5").style;
    var h1 = parseInt(s1.height) - 2;
    if (h1 == 0) return;
    h1 = (h1<2)?2:h1;
    var s2 = document.getElementById("ifrm0").style;
    var h2 = parseInt(s2.height);
    s1.height = (h1) + "px";
    s2.height = (h2+2) + "px";
    setTimeout("doChange()", 50);
    }
    </script>
    <input type='button' value='改变' onclick='document.frames["ifrm0"].location.href="http://cn.yimg.com/i/lg/2/y_cn_lg.gif";doChange()'/>
    <br />
    <iframe id='ifrm5' name='ifrm5'
    src="http://www.google.cn/intl/zh-CN/images/logo_cn.gif"
    style='height:90px;width:500px;'
    scrolling="no" border="0" frameborder="0"></iframe>
    <iframe id='ifrm0' name='ifrm0'
    src="http://www.baidu.com/img/sslm1_logo.gif"
    style='height:200px;width:500px;'
    border="0" frameborder="0" scrolling="yes"></iframe>
    </body>