Reputation: 1
var Stars = 0;
setText("Stars", Stars);
onEvent("FF1", "mouseover", function(event) {
if (Star11 === true) {
console.log("+1 star");
var Stars = Stars + 1;
}
if (Star12 === true) {
console.log("+1 star");
var Stars = Stars + 1;
}
I am trying to make a text box display the value of variable "Stars" after increasing that variable by 2. The text box is set at 0 and I am unable to get it to change based on the value of variable "Stars"
Edit: I have solved the issue
Upvotes: 0
Views: 654
Reputation: 59
If I understood your question correctly, you can do something like this:
HTML:
<input id="stars" type="text" value=""/>
<button onclick="addStars()">
Click Me!
</button>
javaScript:
stars=0;
function addStars() {
stars = stars + 1;
document.getElementById("stars").value = "star "+ stars;
}
Upvotes: 1