I am creating a webpage for science fair to test student's abilities to detect a phishing website. The website will change to look like the Windows log in screen. I need the functions that do this to activate when F11 is pressed. how might I do this?
Asked
Active
Viewed 191 times
0
-
2try this => http://stackoverflow.com/questions/6428242/why-trigger-f11-press-event-doesnt-work. using that function will allow u to trigger whatever functions you want. – PlantTheIdea Oct 28 '13 at 18:38
-
1By binding to the `keypress` event (on the `document`) and checking for the `F11` key (keyCode 122). You might also need to prevent the default action (usually fullscreen) with `preventDefault()`. – gen_Eric Oct 28 '13 at 18:42
-
What part(s) of this do you need help with? Where are you stuck? – gen_Eric Oct 28 '13 at 18:48
2 Answers
0
I'd suggest not using the F11 key, as this is a common shortcut for launching the "full screen" mode in some current browsers. Hence, the browser developers may want to protect the browser from a page author overriding this shortcut.

naivists
- 32,681
- 5
- 61
- 85
-1
$(document).keyup(function(e){
if(e.keyCode===122){
function1();
function2();
}
}

Ash
- 57
- 2
-
1You should probaby [`e.preventDefault()`](http://api.jquery.com/event.preventDefault/), also you should use [`e.which`](http://api.jquery.com/event.which/). Also, the question doesn't even mention jQuery in the first place. – gen_Eric Oct 28 '13 at 18:44