19
rated 0 times
[
22]
[
3]
/ answers: 1 / hits: 35723
/ 11 Years ago, thu, march 7, 2013, 12:00:00
I'm completely new to JavaScript. I'm trying to increment a variable inside the HTML, it's not working. Is my syntax wrong?
<script>
function rps() {
computerScore.value++;
computerScore.innerHTML = computerScore.value;
}
</script>
<html>
<b>computer score:</b><p id=computerScore value=0>-</p>
<button type=button onclick=rps()>Go</button><br>
</html>
More From » increment