How to simulate key press event onload

时间:2015-11-11 11:07:35

标签: javascript jquery keypress simulate

How can I simulate a keyPress event to open the print menu on Chrome with JavaScript or jQuery?

The keys are Ctrl + P

I tried this code in JavaScript but it doesn't work.

function imprimer() {
    robot.keyPress(17);
    robot.keyPress(80);
}
window.onload = imprimer();

1 个答案:

答案 0 :(得分:0)

也许你想使用window.print()函数..