自动打开 URL 延迟
Auto Open URL With Delay
当我用我的 url 加载页面时,代码会立即打开。例如:我有5个url,加载页面,打开这5个url。
如何打开第一个,然后打开第二个和第三个,第四个和第五个?
这是我的代码。
<script>
$(function (){
$(".botao-enviar").each(function (){
var selecionado=[];
var atual=[];
$(this).parent().find('input[type="checkbox"]:checked').each(function (){
atual = $(this).val();
window.open(atual)
});
});
});
</script>
你可以使用setTimeout();
将索引传递给 .each
.each(function (i){
并使用
setTimeout(function(){ window.open(atual) }, i* 1000); //change 1000 with duration you want
当我用我的 url 加载页面时,代码会立即打开。例如:我有5个url,加载页面,打开这5个url。
如何打开第一个,然后打开第二个和第三个,第四个和第五个?
这是我的代码。
<script>
$(function (){
$(".botao-enviar").each(function (){
var selecionado=[];
var atual=[];
$(this).parent().find('input[type="checkbox"]:checked').each(function (){
atual = $(this).val();
window.open(atual)
});
});
});
</script>
你可以使用setTimeout();
将索引传递给 .each
.each(function (i){
并使用
setTimeout(function(){ window.open(atual) }, i* 1000); //change 1000 with duration you want