setInterval、history和navigator

<!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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值