So - I'm working on a new interactive for yet another education project on the nutrient cycle which essentially uses Hype to recreate the attached Excel document. Kids will enter the variables in blue (Any number) and it calculates in the background spitting back what's in the red.
I've started with a very basic version also attached here in Hype format. The idea being once I've figured out the entry and storage of the variables, the math part is relatively easy.
In searching the forums, I found a couple of examples that I understand on the surface, though I haven't gotten the code snippets to perform correctly yet.
How do I let someone enter text in a running Hype document? (Did I do it wrong here?)
How would I then store the numbers in those boxes as variables that I could call to do the math?
var x = hypeDocument.getElementById('startSoil').innerHTML;
var y = hypeDocument.getElementById('startBiomass').innerHTML;
var z = hypeDocument.getElementById('startLitter').innerHTML;
var total = x*y*z;
answerOne.innerHTML = total;
Then this will work!
The good news is that all the rest of the logic/dataflow is correct - which is the "hard" part of programming . Getting the syntax right is just tedious and often unintuitive... I personally still will sometimes type getElementByID myself, even!