能正確運行,可參考
<!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>
2019-09-11
<body>
<h1 style="color: aquamarine;">操作成功</h1><br/>
<span id="djs">3</span>
<span>秒后返回百度網(wǎng)</span>
<a >手動返回</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>