Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <img id="target" src="something.png"/>
- function closeWindow(){
- var theObject = document.getElementById("target");
- var pressEvent = document.createEvent ("KeyboardEvent");
- pressEvent.initKeyEvent("keypress", true, true, window, true, false, false, false, 87, 0);
- theObject.dispatchEvent(pressEvent);
- }
Add Comment
Please, Sign In to add comment