gpt4 book ai didi

javascript - 同步 jquery 警报

转载 作者:行者123 更新时间:2023-11-29 22:14:04 25 4
gpt4 key购买 nike

我有以下功能

function test()
{
jAlert("One","DescriptionOne"); // First jAlert
jAlert("Two","DescriptionOne"); // Second jAlert
window.location = 'test.html'
}

运行此代码时,第一个 jAlert 出现并消失,无需单击“确定”按钮。现在同样发生在第二个 jAlert.Finally test.html 直接加载无需单击任何“确定”按钮。我知道我必须提供回调函数,但我的要求是不使用任何回调函数。

请帮助我如何,

  1. 让第二个 jAlert 等到用户点击第一个 jAlert 的 OK 按钮
  2. 点击第二个 jAlert 的 Ok 按钮后加载 test.html。

最佳答案

是这样的吗?

function test()
{
jAlert("One","DescriptionOne", function() {
jAlert("Two","DescriptionOne", function() {
window.location = 'test.html';
}) // Second jAlert
}); // First jAlert
}

关于javascript - 同步 jquery 警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16273361/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com