php - Windows alert javascript with redirect function -


this script

<script> function myalert() {     alert("you have changed username, logged out in order changes applied"); } </script> 

and button

<input type="submit" value="save" name="btnpass" class="button" onclick="myalert()";/> 

i wanted know if there's way how add redirect script when "okay" button @ alert click. how can add on script? how can add on script? thanks!

use confirm instead of alert

the window.confirm() method displays modal dialog optional message , 2 buttons, ok , cancel.

function myalert() {     var confirmed = confirm("you have changed username, logged out in order changes applied");      // if ok button clicked     if (confirmed) {         window.location.href = 'google.com';     }      return false; // stop form submitting } 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -