Function Keys Interactivity in Storyline Using JavaScript

I am creating simulation for a software in storyline. This simulation has function keys interactivity - F2,F3,F10,F11.

I was able to write trigger code - Jump to Slide when user presses F3 keys.

When I am publishing this project, the function keys are responding to the browser function keys. e.g. when I press F3, instead of going to slide F3, its showing browser's find feature.

I tried to do research on google and articulate forum for how to use functions for simulation its leading me JavaScript.

I understand that I need to use trigger - Excute JavaScript in Storyline.

But I don't know how to write a javascript.

I need JavaScript which will disable browsers function key e.g. F3 and if user presses F3 it should go to the next slide.

I guess I need two JavaScripts; the one which will disable browser's function key, and the other which will assign the user defined function that is go to F3 slide if user presses F3 funciton key.

I know there are tons of website which will give you javascript code. But I find it difficult execute in the Storyline.

I have created an example and uploaded the storylline file in this message.

Please help me to write the javascript in storyline.

Thanks in Advance.

38 Replies
Stuart Gilbert

My comment is in respect to a fairly old thread, I know. I just want to say thanks to those who contributed and especially to Owen for supplying the .story files.  I am about to do a simulation of a mainframe system that uses F-keys and it looks like the information supplied in this thread will really come in handy - and make me look really good in the process. ;)

Thanks again to all.

Stuart Gilbert

I am building a course that mimics a mainframe system (HIMR) and I am experiencing some difficulties with what I will call "non-standard" keys. For instance, I need the learner to input a text string with a Tab key; another example is using a combination of keys (Shift+F1) to perform an action. 

I have loaded a test version of the course to the LMS for testing, and I am not only getting incorrect results, but their actions differ from one browser to another. 

I won't go through the trouble of uploading my .story file here unless this thread is still live. If it is, and if someone might be able to lend a hand, it would be greatly appreciated.


Stuart Gilbert

Randy Cruz

Hi Owen - this is genius! Wondering if there are any scripts to also disable the arrow keys? My interaction required the down arrow to show slide layers using the press key trigger. Seems to work on the first layer but i can't keep pressing the down arrow AND move up several layers. It breaks after the first. Any thoughts?