General area when it fits no where else

Moderator: Mmiscool

User avatar
By Luc Volders
#72673 I am trying to do the following

In basic I have a variable let's say x

How do I access that variable with Javascript
let javascript perform some actions on it
let Basic get the result back from javascript

Any ideas ???
Any example please

Luc
User avatar
By Mmiscool
#72694 Make a text box in the page. Then use the cssid command to hide that text box. You can then use it and when you change the value it should trigger the on change event for that text box.

Also if you are running a program you can take a peak at the browser debugger by pressing f12. You can see the bit of JavaScript used to pass variable back and forth and trigger those functions manually.
User avatar
By Luc Volders
#72740 Thanks Mike.
Been trying but get no results.
I was trying to do something like this:

Code: Select allx = 10
button "change", [change]
button "end", [progend]
textbox x

wprint |<!DOCTYPE html>|
wprint |<html>|
wprint |<body>|
wprint |<script>|

wprint |var a = 10 * x|

wprint |</script>|

wprint |</body>|
wprint |</html>|
wait

[change]
x = a
print a
print x
wait

[progend]
end
wait



so first I declare x in basic
next in javascript I say a = 10 * x
and then in basic I print a and x

did not work. Any example please ???
An example for sending a variable to javascript and an example for retrieving a variable from javascript would be great.

Luc