This is a migrated thread and some comments may be shown as answers.

close radwindow on ESC key press in mozilla is not working

1 Answer 143 Views
Window
This is a migrated thread and some comments may be shown as answers.
Sai Prashad Patro
Top achievements
Rank 1
Sai Prashad Patro asked on 30 Sep 2008, 03:21 AM
Hi,

i am opening a rad window wiht a page.

i have to close the window on ESC key press so i have written this code

function

Escape()

{

var esc=window.event.keyCode;

if(esc==27)

{

var oWindow = window.radWindow || window.frameElement.radWindow;oWindow.close();

}

}


and calling this function in the body onkeypress


<

body onkeypress="Escape();">

It is working fine in IE browsers but not working in Mozilla.
Could you please get the solution please.

Thank you.

Regards,
Sai

1 Answer, 1 is accepted

Sort by
0
Serrin
Top achievements
Rank 1
answered on 30 Sep 2008, 08:36 PM
Hey Sai,

Mozilla.com says...

"IE: keycode - For keyboard events, this is a number representing the key that was pressed. It is 0 for mouse events. For keypress events (not keydown/keyup) of keys that produce output, the Mozilla equivalent is charCode, not keyCode. "

So you might have to do a check on which browser they are using and use charCode in place of keyCode.

You can read more at:

IE vs. Mozilla programming
Tags
Window
Asked by
Sai Prashad Patro
Top achievements
Rank 1
Answers by
Serrin
Top achievements
Rank 1
Share this question
or