bug 379 : ordre des telepaiements sur la page xnet, cacher les anciens paiements
[platal.git] / htdocs / javascript / close_on_esc.js
index f4f3d87..0bf8eeb 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-function closePopup() {
-    window.close();
-}
-if (navigator.appName=="Microsoft Internet Explorer") {
-    function keyboardIE() { if (event.keyCode == 27) closePopup(); };
-    document.onkeydown = keyboardIE;
-} else {
-    function keyboardOther(e) { if (e.keyCode == 27) closePopup(); };
-    document.onkeydown = keyboardOther;
+function closePopup(e) {
+    e = e || window.event;
+    if (e.keyCode == 27) {
+        window.close();
+    }
 }
 
+attachEvent(window, 'keydown', closePopup);
+