用按钮控制iframe显示的网页实现方法 |
本文标签:按钮,iframe,网页 复制代码 代码如下: //有两个按钮分别响应两个事件,用来控制iframe显示的网页 。 <script type="text/javascript"> function bd(){ var baidu = document.getElementById("i"); baidu.src = "http://www.baidu.com"; } function xl(){ var sina = document.getElementById("i"); sina.src = "http://www.sina.com.cn"; } </script> <style type="text/css"> #i{ width:400px; height:300px; } </style> </head> <body> <iframe id = "i" scrolling = "no"> </iframe> <div> <input type = "button" value ="百度" onclick = "bd()"/> <input type = "button" value ="新浪" onclick = "xl()"/> </div> </body> |