这个代码是,,,害,实话说了吧,就是为了popcat.click连点用的。
用法我就不多说了,自行体会
var kbEvent = document.createEvent("KeyboardEvent"); var initMethod = typeof kbEvent.initKeyboardEvent !== 'undefined' ? "initKeyboardEvent" : "initKeyEvent"; kbEvent[initMethod]( "keydown", // event type : keydown, keyup, keypress true, // bubbles true, // cancelable window, // viewArg: should be window false, // ctrlKeyArg false, // altKeyArg false, // shiftKeyArg false, // metaKeyArg 78, // keyCodeArg : unsigned long the virtual key code , else 0 0 // charCodeArgs : unsigned long the Unicode character associated with the depressed key, else 0 ); document.dispatchEvent(kbEvent);
微信扫码查看本文
发表评论