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

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 1.08 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. clearing two dimensional session array using jsp
  2. <script type="text/javascript">
  3.     function textsizer(e) {
  4.     var evtobj=window.event? event : e;
  5.     var element = evtobj.target ? evtobj.target : evtobj.srcElement;
  6.     if (element.tagName.toLowerCase() == "body") {
  7.         var unicode=evtobj.charCode? evtobj.charCode : evtobj.keyCode;
  8.         var actualkey=String.fromCharCode(unicode)
  9.         if(actualkey=="x"){
  10.             show_confirm()
  11.             function show_confirm(){
  12.             var con = confirm("Are You Sure you wan to cancel this bill?");
  13.             if (con ==true){
  14.                 session.invalidate();
  15.             }
  16.             else{
  17.             alert("You pressed Cancel!");
  18.             }
  19.             }
  20.         }
  21.     }
  22. }
  23. document.onkeypress=textsizer
  24. </script>
  25.        
  26. //Your main page
  27. <script type='text/javascript'>
  28. window.onkeypress = function() {
  29.     if (event.keyCode == 88) {
  30.         window.location = 'clear_session.php';
  31.     }
  32. }
  33.  
  34. //clear_session.php
  35. session_start();
  36. session_unset();
  37. session_destroy();
  38. header ("Location:main_page.php"); //redirect back to main page