javascript windows alert with redirect function

后端 未结 4 1659
清酒与你
清酒与你 2020-12-31 15:08

.guys I have the following code:

echo (\"\");


        
相关标签:
4条回答
  • 2020-12-31 15:34

    Use this if you also want to consider non-javascript users:

    echo ("<SCRIPT LANGUAGE='JavaScript'>
               window.alert('Succesfully Updated')
               window.location.href='http://someplace.com';
           </SCRIPT>
           <NOSCRIPT>
               <a href='http://someplace.com'>Successfully Updated. Click here if you are not redirected.</a>
           </NOSCRIPT>");
    
    0 讨论(0)
  • 2020-12-31 15:39

    You could do this:

    echo "<script>alert('Successfully Updated'); window.location = './edit.php';</script>";
    
    0 讨论(0)
  • 2020-12-31 15:50

    Alert will block the program flow so you can just write the following.

    echo ("<script LANGUAGE='JavaScript'>
        window.alert('Succesfully Updated');
        window.location.href='http://someplace.com';
        </script>");
    
    0 讨论(0)
  • 2020-12-31 15:55

    If you would like to redirect the user after the alert, do this:

    echo ("<script LANGUAGE='JavaScript'>
              window.alert('Succesfully Updated');
              window.location.href='<URL to redirect to>';
           </script>");
    
    0 讨论(0)
提交回复
热议问题