第一次提交
This commit is contained in:
60
tomcat/webapps/wms/script/appletFocus.js
Normal file
60
tomcat/webapps/wms/script/appletFocus.js
Normal file
@@ -0,0 +1,60 @@
|
||||
var isNavigator = navigator.appName=='Netscape';
|
||||
|
||||
//setTimeout("letAppletGetFocus();", 1000);//<2F>ٸ<EFBFBD>һ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>
|
||||
|
||||
function letAppletGetFocus()
|
||||
{
|
||||
if ( window.document.applets.length > 0 )
|
||||
{
|
||||
window.document.applets[0].requestDefaultFocus(isNavigator);
|
||||
}
|
||||
}
|
||||
if( isNavigator )
|
||||
{
|
||||
document.captureEvents( Event.KEYUP );
|
||||
}
|
||||
document.onkeyup = letAppletGetFocusOnKeyNPressed;
|
||||
|
||||
function letAppletGetFocusOnKeyNPressed(e)
|
||||
{
|
||||
var keyCode, onlyAltDown;
|
||||
|
||||
if( e )//For Navigator 4.0x, it is true
|
||||
{
|
||||
;
|
||||
}
|
||||
else if( window.event )//For Internet Explorer 4.0x, it is true
|
||||
{
|
||||
e = window.event;
|
||||
}
|
||||
else//Unsupported
|
||||
{
|
||||
return;
|
||||
}
|
||||
onlyAltDown = e.altKey && e.ctrlKey == false && e.shiftKey == false;
|
||||
|
||||
if ( onlyAltDown == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( typeof( e.keyCode ) == 'number' )//For Internet Explorer 4.0x, it is true
|
||||
{
|
||||
keyCode = e.keyCode;
|
||||
}
|
||||
else if( typeof( e.which ) == 'number' )//For Navigator 4.0x, it is true
|
||||
{
|
||||
keyCode = e.which;
|
||||
}
|
||||
else if( typeof( e.charCode ) == 'number' )//Unknown
|
||||
{
|
||||
keyCode = e.charCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( keyCode == 78 || keyCode == 77)//78='N'
|
||||
{
|
||||
letAppletGetFocus();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user