I have an extremely simple radwindow, called as follows:
var oWnd = window.radopen(url, "title");
oWnd.show();
Once in the window I want to be able to close it simply by hitting the Esc key.
I have this code, essentially pieced together from various threads. :
The code below works, but only if I click within the body of the RadWindow first or, if on load, I set the focus to a control within the body.
Anything particularly wrong with this?
$(window).ready(function () {
// Handler for .ready() called.
$(window).keydown(function (e) {
// ESCAPE key pressed
if (e.keyCode == 27) {
var oWnd = GetRadWindow();
oWnd.close();
}
});
});
function closeWindow() {
var oWnd = GetRadWindow();
oWnd.close();
}
function GetRadWindow() {
var oWindow = null;
if (window.radWindow)
oWindow = window.radWindow;
else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
return oWindow;
}
var oWnd = window.radopen(url, "title");
oWnd.show();
Once in the window I want to be able to close it simply by hitting the Esc key.
I have this code, essentially pieced together from various threads. :
The code below works, but only if I click within the body of the RadWindow first or, if on load, I set the focus to a control within the body.
Anything particularly wrong with this?
$(window).ready(function () {
// Handler for .ready() called.
$(window).keydown(function (e) {
// ESCAPE key pressed
if (e.keyCode == 27) {
var oWnd = GetRadWindow();
oWnd.close();
}
});
});
function closeWindow() {
var oWnd = GetRadWindow();
oWnd.close();
}
function GetRadWindow() {
var oWindow = null;
if (window.radWindow)
oWindow = window.radWindow;
else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
return oWindow;
}