js实现打开网页值自动加1,应用在时间秒加1上
<!DOCTYPE html>
<html lang="en">
<head>
<title>打开网页后,值自动累加,自动加1</title>
<style>
body{text-align:center;font:700 30px/1.5 arial;}
</style>
<script>
window.onload = function ()
{
var oBody = document.body;
var i = 0;
setInterval(updateNum, 1000);
updateNum();
function updateNum()
{
oBody.innerHTML = ++i
}
}
</script>
</head>
<body>
</body>
</html>