Javascript Function Library

Hello everybody,

I'm currently making a Storyline project to learn people how to use JavaScript to enhance their own projects and/or simplify it. Things are, I've managed to use the SetVar/GetVar methods but now I'm stuck with the use of a Function library.

I've followed the rather short explications found here:  so I have that MyJSfunctions.js containing my functions I want to use:

function addition(a,b){

var res = a + b;

return res;}

and I have a script in a trigger that calls that function:

var num1 = parseFloat(prompt("Entrez le premier nombre"));

var num2 = parseFloat(prompt("Entrez le second nombre"));

var res = addition(num1,num2); 

alert("Résultat: "+res);

After publishing the project, I put the function-containing file in story_content as told and I'm encountering a problem with the script line that I have to put at "line 113" (I made sure the script line had the right file name in it of course) but the line 113 of my story.html is this:

So yeah, as expected pasting the line there didn't do much so I think my problem is that it's not at the good location.

If my diagnosis is correct and as I'm no expert on html can someone tell me more accurately where do I have to put the <script LANGUAGE="JavaScript1.2" SRC="story_content/Whatever.js" TYPE="text/javascript"></script> line please? 

Thanks in advance

2 Replies