How to obtain data is basically determined from the Action event. In IE, the window object contains the event. For example: [html] & lt ;! -- Addbyoscar999 -- & gt; & lt ;! DOCTYPEHTMLPUBLIC & quot;-// W3C // DTDHTML4.0Transitional // E...
How to obtain
It is basically determined from the Action event.
Processing in IE
In IE, the window object contains the event. See the example below:
[Html]
New Document
Script
Function showWinEvent ()
{
If (window. event. altKey)
{
Alert ("you pressed Alt Key ");
} Else if (window. event. ctrlKey)
{
Alert ("you pressed Ctrl Key ");
} Else if (window. event. shiftKey)
{
Alert ("you pressed Shift Key ");
} Else {
// Alert (window. event. button)
}
}
Script
New Document
Script
Function showWinEvent ()
{
If (window. event. altKey)
{
Alert ("you pressed Alt Key ");
} Else if (window. event. ctrlKey)
{
Alert ("you pressed Ctrl Key ");
} Else if (window. event. shiftKey)
{
Alert ("you pressed Shift Key ");
} Else {
// Alert (window. event. button)
}
}
Script
The above work can be performed in IE and Chrome, but there is a problem in firefox, the undefined error will be reported, because the window object of firefox does not contain event.
Firefox compatibility
[Html]
New Document
Script
Function showWinEvent (evn)
{
If (evn. altKey)
{
Alert ("you pressed Alt Key ");
} Else if (evn. ctrlKey)
{
Alert ("you pressed Ctrl Key ");
} Else if (evn. shiftKey)
{
Alert ("you pressed Shift Key ");
} Else {
// Alert (window. event. button)
}
}
Script
New Document
Script
Function showWinEvent (evn)
{
If (evn. altKey)
{
Alert ("you pressed Alt Key ");
} Else if (evn. ctrlKey)
{
Alert ("you pressed Ctrl Key ");
} Else if (evn. shiftKey)
{
Alert ("you pressed Shift Key ");
} Else {
// Alert (window. event. button)
}
}
Script