Goto Web Address -> Javascript:callingFunctions("withStrings");
May 3, 2012 12:00 AM
Hello,
I've been trying to utilise the Goto Web Address facility to activate Javascript code I have embedded in the HTML. However I am having a little trouble with Lectora not properly parsing strings.
For example, if I had a function embedded into my HTML:
function msg(stringIn)
{
alert(stringIn);
}
and called it through a MouseClick - GotoWebAddress event:
"Javascript:msg("Hello World!");
It will throw errors. On inspection of the code, it's because the quote characters (in "Hello World") break Lectora's parsing when it builds the Javascript for the MouseClick event.
Is there a better way I can use the gotoWebAddress facility to send strings to a javascript function? I tried using escape characters, but didn't have much luck.
(The idea here was to create a library of Javascript functions in the header that I could pass object names into, this would allow me to fade out images with JQuery when a interactions are complete, etc). If there's a better way I could be doing this, i'd be interested.
I could embed the javascript per-page manually, but I like making it simple using Lectora's inheritance.
Discussions have been disabled for this post