Function Keys Interactivity in Storyline Using JavaScript

Feb 07, 2013

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.

49 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? 

Jodi M. Sansone

Hi to all the smart people on this thread. I recognize all of you from other places in the community.

I just was directed here by Joe Tansengco and I can't figure out how to apply the insights here as my javascript skills are limited.   I tried following the conversation but I can't untangle it.

I am working on a free form question interaction that is a text entry question.  I noticed that if I hit the Enter key to advance to a new line within the text entry box, the "Thank you" layer pops up prematurely.  I was hoping there would be a way to avoid this or disable the enter key for this interaction.  I think learners may hit Enter to advance to a new line if they are typing.  We are not trying to track the response as correct/incorrect so I just chose a "Thank you" layer once the interaction is completed.  As I understand it, my client's LMS has the capability to see what people have typed--they don't need it graded, they just want visibility into what people have typed.   Maybe I just have my question set up incorrectly.  If there is a better way to do this, I'm open to it.  I was even looking at using the built-in survey question as an alternative.  Any ideas?  I attached my file for reference.  Thank you!

Math Notermans

Hi Jodi,

First i tried to get it fixed using Javascript, but soon noticed that especially the built-in questions in Storyline are very tied up in the code of Articulate, thus sometimes hard to change. So i reworked your sample to using a normal input textfield...and then it works nice without any need for Javascript.

Basically i just added a normal textinput field and used the data in that to change the values of the question textArea input. Then internally the submit doesnot get triggered and all works fine.

Jodi M. Sansone

Thank you Math. I appreciate the time  you took to help me work through this. I think I might try using the short answer survey or essay survey question too.  My client wants to read the response in the LMS and the survey questions don't have that Enter key issue.  On the positive side, I learned if you press shift+Enter you can advance a line in the text graded question without submitting the interaction, but that's an extra step.   Have a happy New Year!