//模拟按住Shift的同时又按下A键:var text = document.getElementsByTagNames("input")[0];if(document.implementation.hasFeature("KeyboardEvents",3.0){var event = document.createEvent("KeyboardEvent");
event.initKeyboardEvent("keydown",true,true, document.defaultView,"a",0,"Shift",0);}
functionsimulatedClick(target, options){var event = target.ownerDocument.createEvent('MouseEvents'),
options = options ||{},
opts ={// These are the default values, set up for un-modified left clicks
type:'click',
canBubble:true,
cancelable:true,
view: target.ownerDocument.defaultView,
detail:1,
screenX:0,//The coordinates within the entire page
screenY:0,
clientX:0,//The coordinates within the viewport
clientY:0,
ctrlKey:false,
altKey:false,
shiftKey:false,
metaKey:false,//I *think* 'meta' is 'Cmd/Apple' on Mac, and 'Windows key' on Win. Not sure, though!
button:0,//0 = left, 1 = middle, 2 = right
relatedTarget:null,};//Merge the options with the defaultsfor(var key in options){if(options.hasOwnProperty(key)){
opts[key]= options[key];}}//Pass in the options
event.initMouseEvent(
opts.type,
opts.canBubble,
opts.cancelable,
opts.view,
opts.detail,
opts.screenX,
opts.screenY,
opts.clientX,
opts.clientY,
opts.ctrlKey,
opts.altKey,
opts.shiftKey,
opts.metaKey,
opts.button,
opts.relatedTarget );//Fire the event
target.dispatchEvent(event);}