📜  js模拟键盘输入 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:38.784000             🧑  作者: Mango

代码示例1
element.dispatchEvent(new KeyboardEvent("keydown", {
    key: "e",
    keyCode: 69,        // example values.
    code: "KeyE",       // put everything you need in this object.
    which: 69,
    shiftKey: false,    // you don't need to include values
    ctrlKey: false,     // if you aren't going to use them.
    metaKey: false      // these are here for example's sake.
}));