html+js 点击不同的item,实现显示不同的页面

html+js 点击不同的item,实现显示不同的页面

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>

<body>
<script>
    function run(nums)
    {
        var e=document.getElementById("frame1");
        switch(nums)
        {
            case 1:e.src='https://www.baidu.com/';break;
            case 2:e.src='http://cn.bing.com/';break;
            case 3:e.src='http://www.google.cn/';break;
        }
    }
</script>
<div id="mm" style="background-color:#CCC">
    <span><button onClick="run(1)">百度</button></span>
    <span><button onClick="run(2)">bing</button></span>
    <span><button onClick="run(3)">google</button></span>
</div>
<center>
<div id="bd">
     <iframe id="frame1" style="width:25cm; height:20cm" frameborder="0" src="about:blank"></iframe>
</div>
</center>
</body>
</html>
0

Leave a Reply

Your email address will not be published.