JS对象——BOM
JS对象——BOM
一、概述

二、测试代码(请自行进行注释和解注释来进行实验)
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>练习BOM</title>
</head>
<body>
<!-- 获取对象-->
<script>
<!-- windows对象-->// window.alert("Hello");// alert("Hello")// confirm
// var flag = confirm("您确定要删除吗");// alert("falg的值为"+flag);var i = 0;
// 使用setInterval定时器,每隔一段时间(单位是毫秒)会执行一下,可以传递两个参数(间隔时间和一个表示行为的韩式)
// setInterval(function (){
// i++;
// alert("程序已经执行了"+i+"次");
// },2000)// 使用setTimeout函数定时器。会在一定时间隔内仅仅执行一次// setTimeout(function (){// alert("该程序执行在三秒后执行了一次");// },2000)// location对象:可以获取地址栏的URLalert(location.href)
// 除此之外,还可以设置URLlocation.href = "https://www.itcast.cn"</script>
</body>
</html>