码迷,mamicode.com
首页 > Windows程序 > 详细

window对象

时间:2019-08-24 00:47:11      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:button   有关   tin   result   eww   rip   charset   com   write   

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Window对象</title>

</head>
<body>
<input type="button" id="openBtn" value="打开按钮">
<input type="button" id="closeBtn" value="关闭按钮">

<script>
//与窗口弹出相关
alert("this is test");
var flag = confirm("你确定要退出吗?");
if(flag){
document.write("bye-bye"+"<br>");
}else{
document.write("noties"+"<br>");
}
var result = prompt("请输入用户名");
document.write(result+"<br>")

//与窗口打开关闭有关

var openbtn= document.getElementById("openBtn");
var newWindow;
openbtn.onclick = function(){
newWindow = open("https://www.baidu.com");
}

var closebtn = document.getElementById("closeBtn");
closebtn.onclick=function () {
newWindow.close();
}

//与定时器有关
function fun() {
document.write("bomb.....");
}
var id = setTimeout(fun,3000);
clearTimeout(id);

var interval = setInterval(fun,3000);
clearInterval(interval);

</script>
</body>
</html>

window对象

标签:button   有关   tin   result   eww   rip   charset   com   write   

原文地址:https://www.cnblogs.com/newcityboy/p/11403180.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!