关于JavaScript浏览器对象

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
 5 <title>自定义导航</title>
 6 <script type="text/javascript">
 7     function display(index){
 8          switch(ind){
 9              
10              case 1:
11              window.frames["index"].location.href = "https://www.baidu.com";
12              break;
13              
14              case 2:
15              window.frames["index"].location.href = "http://www.ijinshan.com/sem/xintop/f31.shtml?sfrom=166&keyID=1653";
16              break;
17              
18              case 3:
19              window.frames["index"].location.href = "http://www.ijinshan.com";
20              break;
21              }
22         }
23 </script>
24 </head>
25 <body>
26     <a href="javascript:history.forward();">前进</a>
27     <a href="javascript:history.back();">后退</a>
28     <a href="javascript:history.go(0);">刷新</a>
29     <p>
30     <input type="button" value="第一个页面" onclick="display(1)"/>
31     <input type="button" value="第二个页面" onclick="display(2)"/>
32     <input type="button" value="第三个页面" onclick="display(3)"/>
33     </p>
34     <iframe src="https://www.baidu.com" name="ind" width="1300px" height="800"/>
35 </body>
36 </html>
自定义导航

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>window对象</title>
<script type="text/javascript">
    function change(){
        var myconfirm = confirm("英雄可以吗?");
        if(myconfirm){
            document.getElementById("info").style.fontWeight = "bold";
            document.getElementById("info").style.color = "#999";
            }
        }
        
    function myprompt(){
        var name = prompt("what's your name ?","请输入");
        document.write("名字:"+name+"<hr/>");
        }
</script>
</head>
<body style="font-size:14px">
    <input type="text" id="info" value="德玛西亚" />
    <input type="button" value="亚瑟" onclick="change()"/>
    
    <input type="button" value="问名" onclick="myprompt()"/>
</body>
</html>
window对象

 

posted @ 2018-05-10 22:51  得归  阅读(193)  评论(0编辑  收藏  举报