Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/414.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 完成10个随机页面中的5个页面_Javascript_Html - Fatal编程技术网

Javascript 完成10个随机页面中的5个页面

Javascript 完成10个随机页面中的5个页面,javascript,html,Javascript,Html,我如何确保用户已经完成了随机10页中的任意5页?例如,第5页将触发一条警告消息,提示其已完成。每个页面都有这组代码,包括索引/主页 var randomlinks = new Array() randomlinks[0] = "square1.html" randomlinks[1] = "square2.html" randomlinks[2] = "square3.html" randomlin

我如何确保用户已经完成了随机10页中的任意5页?例如,第5页将触发一条警告消息,提示其已完成。每个页面都有这组代码,包括索引/主页

var randomlinks = new Array()

            randomlinks[0] = "square1.html"
            randomlinks[1] = "square2.html"
            randomlinks[2] = "square3.html"
            randomlinks[3] = "square4.html"
            randomlinks[4] = "square5.html"
            randomlinks[5] = "square6.html"
            randomlinks[6] = "square7.html"
            randomlinks[7] = "square8.html"
            randomlinks[8] = "square9.html"
            randomlinks[9] = "squareLast.html"

            function randomlink() {
                window.location = randomlinks[Math.floor(Math.random() * randomlinks.length)]
            }

<button class="btnSquare" onclick="randomlink()"></button>   
var randomlinks=新数组()
随机链接[0]=“square1.html”
随机链接[1]=“square2.html”
随机链接[2]=“square3.html”
随机链接[3]=“square4.html”
随机链接[4]=“square5.html”
随机链接[5]=“square6.html”
随机链接[6]=“square7.html”
随机链接[7]=“square8.html”
随机链接[8]=“square9.html”
randomlinks[9]=“squareLast.html”
函数randomlink(){
window.location=randomlinks[Math.floor(Math.random()*randomlinks.length)]
}

您可能想看看(尤其是不想看到,因为您不想让这些知识持续存在于当前选项卡之外)如何识别用户?这些是静态页面吗?已经完成意味着什么,是否有类似于表单提交的东西?请添加更多上下文,以便我们可以为您提供一个好的解决方案。