Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 27th, 2012  |  syntax: None  |  size: 1.33 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. simple jquery alert window
  2. <input type = "button" value="show alert">
  3.  
  4. <script>
  5.  $("input").click(function(){
  6.    )};
  7.  </script>
  8.        
  9. <input type="button" id="redirect" value="show alert" />
  10. <div id="alertWindow">
  11.     You'll be redirect to google.com. Continue?
  12.     <br /><br />
  13.     <input type="button" id="btnOk" value="OK" /> <input type="button" id="btnCancel" value="Cancel" />
  14. </div>
  15.        
  16. #alertWindow {
  17.   display: none;
  18.   text-align: center;
  19.   border: 1px solid #333;
  20.   width: 200px;
  21.   height: 80px;
  22.   border-radius: 5px;
  23.   padding: 10px;
  24. }
  25. #btnOk, #btnCancel { width: 70px; }
  26.        
  27. $(function() {
  28.     $("#redirect").click(function(){
  29.       $('#alertWindow').show();
  30.       return false;
  31.     });
  32.     $('#btnCancel').click(function() {
  33.         $('#alertWindow').hide();
  34.     });
  35.     $('#btnOk').click(function() {
  36.         location.href = 'http://www.google.com';
  37.         return false;
  38.     });
  39. });
  40.        
  41. <input type = "button" value="show alert">
  42.  
  43. <script>
  44.  $("input").click(function(){
  45.        $("#myDiv").dialog({
  46.             buttons: {
  47.                  "OK": function() {
  48.                         window.location.href = //my url
  49.                  },
  50.                  "Cancel": function() {
  51.                          this.dialog("close");
  52.                  }
  53.              })
  54.              //put all your other dialog options here
  55.         });
  56.    )};
  57.  </script>