ManLeE
2019-08-26 19:07
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>定时器</title>
<script type="text/javascript">
var attime;
function clock(){
var time=new Date();
attime=time.getHours()+":"+time.getMinutes()+":"+time.getSeconds();
document.getElementById("clock").value = attime;
}
setInterval(clock,100);
</script>
</head>
<body>
<form>
<input type="text" id="clock" size="50" />
</form>
</body>
</html>
<body>
<h1 style="color: aquamarine;">操作成功</h1><br/>
<span id="djs">3</span>
<span>秒后返回百度网</span>
<a href="https://www.baidu.com">手动返回</a><br>
<a href="javascript:bank();">返回</a>
<script type="text/javascript">
var num=document.getElementById("djs").innerHTML;
function count()
{
num--;
document.getElementById("djs").innerHTML=num;
if(num==0)
{
location.assign("https://www.baidu.com");
}
}
setInterval("count()",1000);
function back()
{
window.history.back();
}
</script>
</body>
JavaScript进阶篇
468061 学习 · 21891 问题
相似问题