How I can send a combination of keys (like Ctrl+C or Alt+Shift) when cursor goes in a input text field using Javascript?
I'm not using jQuery but am using MS-Ajax. Is it possible using MS-Ajax DOM?
EDIT 1)
According to @Ghostoy help,I wrote this code:
function simulateKeyPress() {
var evt = document.createEvent("KeyboardEvent");
evt.initKeyEvent("keypress", true, true, window,
0, 0, 0, 0,
0, "e".charCodeAt(0))
var canceled = !body.dispatchEvent(evt);
if (canceled) {
alert("canceled");
} else {
alert("not canceled");
}
}
but when called it I got an error:
Error: Object doesn't support property or method 'initKeyEvent'
and then I changed the KeyboardEvent
to KeyEvents
I got this error:
Error: DOM Exception: NOT_SUPPORTED_ERR (9)
where is my fault?