gpt4 book ai didi

javascript - 我可以在一段时间间隔(例如 10 秒)后将 innerHTML 文本重定向回我的主页吗?

转载 作者:行者123 更新时间:2023-12-03 11:34:44 24 4
gpt4 key购买 nike

当我注册一个新帐户并且一切顺利时,这部分代码将运行并更改表单以显示消息“检查您的电子邮件[...]”。我试图让消息仅显示几秒钟,然后重定向回主页。

_("signupbutton").style.display = "none";
status.innerHTML = 'please wait ...';
var ajax = ajaxObj("POST", "signup.php");
ajax.onreadystatechange = function() {
if(ajaxReturn(ajax) == true) {
if(ajax.responseText != "signup_success"){
status.innerHTML = ajax.responseText;
_("signupbutton").style.display = "block";
}else {
window.scrollTo(0,0);
_("wrap").innerHTML = "<div >Check your email inbox to complete the sign up process by activating your account.</div>";

最佳答案

正如评论中提到的,您只需要使用 setTimeoutlocation

_("signupbutton").style.display = "none";
status.innerHTML = 'please wait ...';
var ajax = ajaxObj("POST", "signup.php");
ajax.onreadystatechange = function() {
if(ajaxReturn(ajax) == true) {
if(ajax.responseText != "signup_success"){
status.innerHTML = ajax.responseText;
_("signupbutton").style.display = "block";
}else {
window.scrollTo(0,0);
_("wrap").innerHTML = "<div >Check your email inbox to complete the sign up process by activating your account.</div>";
setTimeout(function() {
window.location = 'homepage.html'; // or whatever the URL is
}, 10000);

关于javascript - 我可以在一段时间间隔(例如 10 秒)后将 innerHTML 文本重定向回我的主页吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26569582/

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