Update Button HTML inside IF Statement


(Will Landen) #1

I have search and have not found a solution. Can someone help. I am coming from Swift with an app to see what parts work in HTML to create an “HTML” Android App. I would hope Hype can handle these kinds of JS.

Part I
If bDisplay0 = 0, Make it show 7. It works fine without the IF but I have been unsuccessful getting the IF part to do anything.

function bEnter7Function(hypeDocument, element, event) {
if (hypeDocument.getElementById(“bDisplay0”).innerHTML == “0”) {
hypeDocument.getElementById(“bDisplay0”).innerHTML = “7”;
}
}

Part II
How to pass this value to a variable on another scene.


(Mark Hunte) #2

Hi,

Can you supply an example project. This will help us see what is going on with what you are doing instead of just a snippet where the problem may not be. This also means we do not need to try and recreate what we think you are doing…

i.e The code you have there is correct in so far as syntax and does work. But we have no idea what element type you are trying to use it on or how you are calling it.

please elaborate ??


(Will Landen) #3

I figured out the IF (for some reason) would not work when comparing (hypeDocument.getElementById(“bDisplay0”).innerHTML to a string value. I converted (hypeDocument.getElementById(“bDisplay0”).innerHTML to var (saveNumber) and the IF worked flawlessly.

i.e.
saveNumber = (hypeDocument.getElementById(“b0”).innerHTML)

if (saveNumber == “0”) {
hypeDocument.getElementById(“b0”).innerHTML = “1”
}

Hopefully this description might help the next person encountering this problem, or I guess it could just be my setup???

I created an App in Swift for the App store. It is called Smart Pitch Counter and is for Coaches and Parents of Travel and other Baseball players to track pitch counts. It gives them detail information to manage the Required Days Rest Limits set forth by a number of organizations.

www.o-a-s-i.com/smartpitchcounter.html

I have one more hurdle to tackle with JS and passing values between scenes, but it will be next week before I even have time to think about it.


(Mark Hunte) #4

Just load your value into a global var.

i.e window.fooValue

But again not noing what you are doing…


(Will Landen) #5

I figured it out!!! yahoo…

Thanks