Javascript 如何在Jquery中设置时间自动重定向

Javascript 如何在Jquery中设置时间自动重定向,javascript,jquery,html,Javascript,Jquery,Html,如果我的脚本正在执行,谁能帮我设置自动重定向的时间 我想有一个计时器,因为它会自动重定向到页面和我的确认弹出对话框关闭这么快 当前代码: <script> $(document).ready(function() { // show a dialog box when clicking on a link $.Zebra_Dialog('<strong>Congratulations! </strong> <br> ' +

如果我的脚本正在执行,谁能帮我设置自动重定向的时间

我想有一个计时器,因为它会自动重定向到页面和我的确认弹出对话框关闭这么快

当前代码:

<script>
$(document).ready(function() {
 // show a dialog box when clicking on a link
$.Zebra_Dialog('<strong>Congratulations! </strong> <br> ' +
                         'You have successfully registered!', {
                         'type':     'confirmation',
                         'title':    'Non-uniformed Personnel (NUP)',
                         'auto_close': 10000
                        });
window.location.replace("index.php");

});
</script>

$(文档).ready(函数(){
//单击链接时显示对话框
$.Zebra_对话框('恭喜!
'+ “您已成功注册!”{ “类型”:“确认”, “职务”:非军警人员(NUP), “自动关闭”:10000 }); window.location.replace(“index.php”); });
尝试使用setTimeout。使用setTimeout可以控制执行任何操作的持续时间。

尝试使用setTimeout。使用setTimeout可以控制执行任何操作的持续时间

setTimeout(function() {
    window.location.replace("index.php")
},5000);
这将在5秒内设置要更换的位置


这将在5秒钟内设置要替换的位置。

您可能需要这样的内容:

 <script>
$(document).ready(function() {
// show a dialog box when clicking on a link
$.Zebra_Dialog('<strong>Congratulations! </strong> <br> ' +
                      'You have successfully registered!', {
                      'type':     'confirmation',
                      'title':    'Non-uniformed Personnel (NUP)',
                      'auto_close': 10000
                    });
setTimeout(function(){       
 window.location.replace("index.php");
 },10000);

 });
</script>

$(文档).ready(函数(){
//单击链接时显示对话框
$.Zebra_对话框('恭喜!
'+ “您已成功注册!”{ “类型”:“确认”, “职务”:非军警人员(NUP), “自动关闭”:10000 }); setTimeout(函数(){ window.location.replace(“index.php”); },10000); });
您可能想要这样的东西:

 <script>
$(document).ready(function() {
// show a dialog box when clicking on a link
$.Zebra_Dialog('<strong>Congratulations! </strong> <br> ' +
                      'You have successfully registered!', {
                      'type':     'confirmation',
                      'title':    'Non-uniformed Personnel (NUP)',
                      'auto_close': 10000
                    });
setTimeout(function(){       
 window.location.replace("index.php");
 },10000);

 });
</script>

$(文档).ready(函数(){
//单击链接时显示对话框
$.Zebra_对话框('恭喜!
'+ “您已成功注册!”{ “类型”:“确认”, “职务”:非军警人员(NUP), “自动关闭”:10000 }); setTimeout(函数(){ window.location.replace(“index.php”); },10000); });
在对话框后使用
设置超时

 $.Zebra_Dialog('<strong>Congratulations! </strong> <br> ' +
                         'You have successfully registered!', {
                         'type':     'confirmation',
                         'title':    'Non-uniformed Personnel (NUP)',
                         'auto_close': 10000
 });

setTimeout(function() {
    window.location.replace("index.php")
},10000);  //change the time value accordingly
$.Zebra\u对话框('恭喜!
'+ “您已成功注册!”{ “类型”:“确认”, “职务”:非军警人员(NUP), “自动关闭”:10000 }); setTimeout(函数(){ window.location.replace(“index.php”) },10000); //相应地更改时间值
在对话框后使用
设置超时

 $.Zebra_Dialog('<strong>Congratulations! </strong> <br> ' +
                         'You have successfully registered!', {
                         'type':     'confirmation',
                         'title':    'Non-uniformed Personnel (NUP)',
                         'auto_close': 10000
 });

setTimeout(function() {
    window.location.replace("index.php")
},10000);  //change the time value accordingly
$.Zebra\u对话框('恭喜!
'+ “您已成功注册!”{ “类型”:“确认”, “职务”:非军警人员(NUP), “自动关闭”:10000 }); setTimeout(函数(){ window.location.replace(“index.php”) },10000); //相应地更改时间值