javascript return confirm() – user redirection

The javascript “confirm” script is used on a webpage where you need to give the user a choice. If they press the OK button in the popup, it redirects them. If they press cancel, then it cancels the script and leaves things as is.

<script type="text/javascript">
 <!--
 function confirmation() {
   var answer = confirm("Put pop up window message here")
   if (answer){
     window.location = "url for user after they pushed ok";
   }else{
     window.location = "url for user after they pushed cancel";
   }
 }
 //-->
 </script>


Comments are closed.

Post Navigation