Explore the community Forums Lectora Lectora Questions & Answers Javascript to generate Lectora action?? Reply To: Javascript to generate Lectora action??

#361472 Score: 0
Profile photo of Andrew Lian
Andrew Lian
friend finder
wise owl
curious george
12 pts

Actually, triggering a JS function is not ok :(.

As a followup – if I place the following piece of code in a JS action, a string with a link is published correctly to a text box. If I click on the link nothing happens. If I substitute a URL for the onClick, the URL works fine. It seems that the function is not found, but where to put it? I tried an HTML object (head of file) bu that did not work either.

Code below

function MyFunction(x, y) {
alert (“In MyFunction= ” + x*y);

mystring = ‘link text‘; // This is published correctly (below) but does nothing when you click the link — The OnCLick works fine in a normal html page

var message = document.getElementById(“text4908”);

message.innerHTML=mystring; // This publishes a URL in a textbox – published correctly but nothing happens to call the function – a URL instead of a function works fine in Lectora

alert(yourstring); // The function call is ok

  • This reply was modified 3 years, 3 months ago by Profile photo of Andrew Lian Andrew Lian.