Home > Backend Development > PHP Tutorial > alert不起作用,怎么不会弹框,是有什么冲突吗 求大神帮忙

alert不起作用,怎么不会弹框,是有什么冲突吗 求大神帮忙

DDD
Release: 2023-11-27 15:53:47
Original
2052 people have browsed it

    if ($user_password != $user_password1) {   
                    echo "<script language=\"javascript\"> alert(&#39;您输入的密码不一致,请返回重新输入!&#39;);</script>";   
                    header("Location:../views/user/addUser.php");   
                    exit();   
                }
Copy after login

回复讨论(解决方案)

alert不起作用,不会弹框,求大神帮忙

这样写是试试

echo &#39;<script language="javascript">alert("您输入的密码不一致,请返回重新输入!");</script>&#39;;
Copy after login
Copy after login


这样写是试试

echo &#39;<script language="javascript">alert("您输入的密码不一致,请返回重新输入!");</script>&#39;;
    echo "";                      header("Location:../views/user/addUser.php");
Copy after login


这两句这样写对了

  echo &#39;<script language="javascript">&#39;;  
                    echo &#39;alert("您输入的密码不一致,请返回重新输入!");&#39;;  
                    echo "location.href=&#39;../views/user/addUser.php&#39;";  
                    echo &#39;</script>&#39;;
Copy after login


这样写是试试

echo &#39;<script language="javascript">alert("您输入的密码不一致,请返回重新输入!");</script>&#39;;
Copy after login
Copy after login


 
谢谢你的及时回答

直接Location重定向了,没有运行js代码的机会  
你应该全部使用js代码提示并跳转,而且最好用confirm()让用户读完提示,点确定后location.href跳转


直接Location重定向了,没有运行js代码的机会  
你应该全部使用js代码提示并跳转,而且最好用confirm()让用户读完提示,点确定后location.href跳转


 
嗯嗯 我试试  谢谢你

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template