Firing ctrl+r, ctrl+a, ctrl+q events on a button click

橙三吉。 提交于 2019-12-04 08:31:10
PurkkaKoodari

You can't simulate browser control keys, but you can simulate their effects.

Ctrl-R refreshes.

function refresh() {
    location.reload(true);
} 

Ctrl-A selects everything. Code is from here.

function selectAll() {
    var e = document.getElementsByTagName('body')[0];
    var r = document.createRange(); r.selectNodeContents(e);
    var s = window.getSelection();
    s.removeAllRanges();
    s.addRange(r);
}

I am not sure what Ctrl-Q is supposed to do; if it quits the browser, that one isn't possible.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!