<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>setInterval、history和navigator</title>
</head>
<body>
<input type="text" id="time1">
<input type="text" id="time2">
<button id="btn" οnclick="test()">清除时间</button>
<button id="btn2" οnclick="clock2()">累计计数</button>
<button οnclick="clears()">清除累计</button>
<a href="http://www.baidu.com">跳转</a>
<hr>
<script>
//prompt()
function clock(){
var time1 = new Date();
document.getElementById('time1').value = time1;
}
var i = setInterval(clock,1000)
function test(){
clearInterval(i)
}
var num = 0;
function clock2(){
num++;
document.getElementById("time2").value = num;
j = setTimeout(clock2,1000)
}
//var j = setTimeout(clock2,3000)
function clears(){
clearInterval(j)
}
var his = window.history;
//.length本页面有多少网页访问
document.write(his.length)
document.write(his)
console.log(his.forward())
//go()返回第几个页面
console.log(his.go(1));
document.write('<br>')
var b = navigator.appName;
var b_version = navigator.appVersion;
document.write(b);
document.write('<br>')
document.write(b_version)
document.write('<br>')
document.write(navigator.platform)
</script>
</body>
</html>
setInterval、history和navigator
最新推荐文章于 2022-07-03 15:00:16 发布