Copy link to clipboard
Copied
Hi,
I have 2 questions:
1. How I could access a variable assigned via a Text Entry Box by a user in a JS script? For example a user fills in an entry box (and therefore assigning a variable accessible in the Captivate interface by $$v_my_variable$$), and I would like to access the value within a js window to do some JS calculations on it.
2. How do I do the opposite. I generate some values within a js (eg. generating a random number and assigning it to a variable, eg:
var number = alert(Math.random());
How do I access $$number$$ from a text box or a smart shape in Captivate?
Thank you
I have been successful at manipulating variables with javascript by simply using
window.variableName
For example, I have a variable called points. The value of this variable is created by concatenating two other variables - red and black.
The javascript looks like this:
window.points=String(window.black).concat(red);
Perhaps this example may be useful in advancing your project.
Copy link to clipboard
Copied
I am not a JS expert, but maybe these articles I wrote for newbies like myself, does explain how to exchange variables using JS. I did use TEB's:
Copy link to clipboard
Copied
Thanks - I found what I needed in the posts that you linked.
Copy link to clipboard
Copied
I have been successful at manipulating variables with javascript by simply using
window.variableName
For example, I have a variable called points. The value of this variable is created by concatenating two other variables - red and black.
The javascript looks like this:
window.points=String(window.black).concat(red);
Perhaps this example may be useful in advancing your project.
Copy link to clipboard
Copied
Thanks. That's even more informative points.