<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<script type="text/javascript">
function next_id(){
var current_id = 0
return function (){
return ++current_id
}
}
var g = next_id()
for( let i = 0i <10i++ ){
console.log(g())
}
</script>
<body>
</body>
</html>
var tips = []//如果名字都是123这样的顺序的话,就写循环
for(var i=1i<=50i++){
tips.push(''+i+'.php')
}
//随机需要单独一个函数
var num = 0//初始化定义数字
var writeRandom = function(){
//判断,如果num = 0 ,则随机,否则自增
if(num == 0){
num = Math.floor(Math.random() * tips.length)
}else{
num ++
}
document.write(tips[num])
}
setInterval(writeRandom,3000)//3秒一次调用