echo "<html>";
echo "<head>";
echo "<script>";
echo " function logout()";
echo " {";
echo " var r=confirm(\"Are you sure you want to logout?\");";
echo " if (r==true){window.location.href=\"http://www.google.com\";}";
echo " }";
echo "</script>";
echo "</head>";
echo "<body>";
echo "<div ALIGN=\"right\" onclick=\"logout();\"> <a href=\"\">Logout </a> </div>";
echo "</body>";
echo "</html>";
从上面的代码中,我只想将用户重定向到www.google.com
一旦用户在确认框中单击“是”。我试图在 ( r == true
) 之后立即发出警报,它可以工作,但是页面没有转到www.google.com
. 我可以知道我错过了什么吗?