javascript 如何通过使用 jquery 单击链接来执行键盘快捷键 CTRL + P
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30711523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to execute keybord shortcut CTRL + P by clicking a link using jquery
提问by Anas Abouzaradi
I want to print a page to do so I have to click CTRL+ P, so I would like to make a link to ease the process. Any help is appreciated!
我想打印一个页面,所以我必须点击CTRL+ P,所以我想制作一个链接来简化这个过程。任何帮助表示赞赏!
回答by Rory McCrossan
You don't need to simulate a CTRL+ Pkeypress to print the window - you can just call window.print()
when required instead.
您不需要模拟CTRL+P按键来打印窗口 - 您可以window.print()
在需要时调用。