Home | History | Annotate | Download | only in manual-tests
      1 <html>
      2 <script type="text/javascript">
      3 
      4 function context_event(event)
      5 {
      6   if (window.event)
      7   {
      8     event = window.event;
      9   }
     10   var swallow = document.getElementById("swallow_context").checked;
     11 
     12   var str =
     13          "EVENT PROPERTIES<br>"                       +
     14          "cancelable      = "+event.cancelable+"<br>" +
     15          "ctrlKey         = "+event.ctrlKey+"<br>"    +
     16          "metaKey         = "+event.metaKey+"<br>"    +
     17          "shiftKey        = "+event.shiftKey+"<br>"   +
     18          "<br>"                                       +
     19          "TEST PROPERTIES<br>"                        +
     20          "prevent default = "+swallow+"<br>"          +
     21          "event time      = "+new Date()+"<br>"       +
     22          "";
     23   document.getElementById("event_info").innerHTML=str;
     24 
     25   if (swallow)
     26   {
     27     if ((typeof event.cancelBubble) != "undefined")
     28       event.cancelBubble=true;
     29 
     30     if ((typeof event.preventDefault) != "undefined")
     31       event.preventDefault();
     32 
     33     if ((typeof event.returnValue) != "undefined")
     34       event.returnValue = false;
     35 
     36     if ((typeof event.stopPropagation) != "undefined")
     37       event.stopPropagation();
     38 
     39     return false;
     40   }
     41 
     42   return true;
     43 }
     44 
     45 </script>
     46 
     47 <body oncontextmenu="return context_event(event)">
     48 <div>To activate context menu, right-click or ctrl-click anywhere on the page.</div>
     49 <div>&nbsp;</div>
     50 <div><input type="checkbox" value="1" name="swallow_context" id="swallow_context"> Prevent default context menu</div>
     51 <div>&nbsp;</div>
     52 <tt id="event_info" style='background-color:#eeeeee'>
     53  -- No event captured --
     54 </tt>
     55 </body>
     56 </html>