我想只用html和js实现,我的网页只有一个iframe和两个按钮,我想实现点一个按钮换一个不同的iframe不同的iframe是因为这两个iframe设置的值不一样,谢谢

解决方案 »

  1.   

    可以把一个先隐藏起来,点击一个按钮的时候隐藏先前显示的,打开先前隐藏的
    <div id="test" style="display:none;">
    <iframeframeBorder=0 id=heads src="framepage.htm" style="HEIGHT: 200px; LEFT: 220px; POSITION: absolute; TOP: 200px; WIDTH: 500px">
    </iframe>
    </div>
    </div>
    <input type="button" onclick="document.all.bodyframe.style.display='block';" value="显示">
    </div>
    </div>
    <input type="button" onclick="document.all.bodyframe.style.display='none';" value="隐藏">
    </div>
      

  2.   


    document.getElementById("iframeId").contentWindow.location ="xx.html";
    document.getElementById("iframeId").src="yy.html";
    window.frames["iframeId"].document.body.innerHTML="zzzz";
    ......
      

  3.   

    <div id="test" style="display:none;"> 
    <iframeframe Border=0 id=heads src="framepage.htm" id="iframe" style="HEIGHT: 200px; LEFT: 220px; POSITION: absolute; TOP: 200px; WIDTH: 500px"> 
    </iframe> 
    </div> 
    </div> 
    <input type="button" onclick="change("iframe1.htm")"value="显示"> 
    <input type="button" onclick="change("iframe2.php")value="变化"> 
    <script>
    function change(id_htm){
        document.getElementById("iframe").src = id_htm;
    }
    </script>
    </div> 
    </div> 
    是不是需要这样的效果