The following works fine everywhere except in IE 11:
if( event.keyCode == 18 )
{
event.preventDefault ? event.preventDefault() : event.returnValue = false
altcurrentstate = "keyisdown";
Xmouse = x;
Ymouse= y;
return false;
}
I also tried the others ways offered in this site but nope, can't seems to preventDefault
in IE 11 no matter what, for the alt and arrow keys. The event.returnValue = false;
trick is not working either. Not working with return false either...
尝试在回调函数中实际return false
。
Perhaps you need to make your event cancelable using the initEvent() method.
According to the remarks at the bottom of this page :
If you cannot cancel the event, calling IDOMEvent::preventDefault has no effect.
When you create a custom event by using the IDocumentEvent::createEvent method, you can set the IDOMEvent::cancelable property by using the IDOMEvent::initEvent method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.