Is it possible to post form data by using the keydown javascript method?

I have to write a "backup" app for an emergency response system whose users are used to hitting the F keys (old mainframe system) to bounce between screens. They don't want to modernize at all (mouse? whats that!?) and would prefer that the functionality remain the same so there's no learning curve. I have the javascript to detect the f keys being pressed, but can't seem to find a way to pass some form data so I can have them navigate this pig.

有帮助吗?

解决方案

The basic outline is:

document.body.addEventListener("keydown", function (event) {
    if (event.keyCode === 70) { // 70 = f
        document.getElemenById("formforpigs").submit();
    }
});

You could set up the keydown listener to listen to all kinds of keys and shortcuts, making it more modular is also a good idea.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top