<div class="codetitle"> <span><a style="CURSOR: pointer" data="877" class="copybut" id="copybut877" onclick="doCopy('code877')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code877"> <br>//有兩個按鈕分別回應兩個事件,用來控制iframe顯示的網頁。 <br><script type="text/javascript"> <BR>function bd(){ <BR>var baidu = document.getElementById("i"); <BR>baidu.src = "http://www. baidu.com"; <BR>} <BR>function xl(){ <BR>var sina = document.getElementById("i"); <BR>sina.src = "http://www.sina.com. cn"; <BR>} <BR></script> <br><style type="text/css"> <BR>#i{ <BR>width:400px; <BR>height:300px; <BR> } <BR></style> <br> <br><br> <br><iframe id="i" scrolling="no"> <br></iframe> <br> <div> <br><input type="button" value="百度" onclick="bd()"> <br><input type="button" value="新浪" onclick="xl()"> <br> </div> <br> <br> </div>