您的位置:首页 > 其它

用按钮控制iframe显示的网页

2012-08-01 19:22 316 查看
View Code

//有两个按钮分别响应两个事件,用来控制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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: