JavaScript Object [BOM]

1.Window objects:

It represents the browser window that opens

 

 

setInterval (): it has a return value, is supplied to the main clearInterval use.
setTimeout (): it has a return value, is supplied to the main clearTimeout use.
clearInterval (): This method can only be cleared by the timing of the operation setInterval set.
clearTimeout (): This method can only be cleared by the timing of the operation setting setTimeout.

 

Code:

< Script > 
//         // confirmation pop-up box 
//             Confirm The ( "OK to delete it?"); 
//             // input box 
//             prompt ( "Please enter the content:"); 
</ Script >
< Body > 
        < A href = "02 - History Object .html" > Point me! </ A > 
</ body >

 

result:

http://127.0.0.1:8020/WEB03_JS/%E6%A1%88%E4%BE%8B%E4%B8%89%EF%BC%9A%E4%BD%BF%E7%94%A8JS%E5%AE%8C%E6%88%90%E9%A1%B5%E9%9D%A2%E5%AE%9A%E6%97%B6%E5%BC%B9%E5%87%BA%E5%B9%BF%E5%91%8A/BOM%E5%AF%B9%E8%B1%A1/01_window%E5%AF%B9%E8%B1%A1.html

 

 

2.History objects:

History object contains the URL the user visited (in the browser window)
 
 
History page: use location page (the href attribute value to the current history)
 
History page code:
<Input type = "button" value = "return to the previous page."
onclick="javascript:history.back()"/>
 
go parameters: a return -1 History page; -2 return to the previous page history; 1 enters the next context
History records page.
 
Click the button to make failure:
onclick=”javascript:volid(0)” 
 
Code:
<script>
            function fanhui() {
                history.go(1);
// histroy.go(-1);
// history.back(); } </script>
<body>
    <input type="button" value="返回上一页" onclick="fanhui()" />
    <a href="03_location对象.html">下一页</a>
</body>
 
 
3.Location 对象
Location 对象包含有关当前 URL 的信息。 
href:该属性可以完成通过 JS 代码控制页面的跳转。 
 
代码:
<body>
        <input type="button" value="跳转到history页面" onclick="javascript:location.href='02——history对象.html'"/>
</body>
 
结果:
 
 
4.Navigator 对象
Navigator 对象包含有关浏览器的信息。(该对象开发中不怎么常用)
5.Screen 对象
Screen 对象包含有关客户端显示屏幕的信息。(该对象开发中不怎么常用)
 

 

Guess you like

Origin www.cnblogs.com/musecho/p/11022420.html