开发者

How to store the value of a counter for a high score table?

I'm making a whack-a-mole game in javascript and I need to figure out how to make a highscore table. I was thinking an HTML5 database would work nicely, but I can't figure out how to integrate it. I have a counter that counts the number of successful clicks on the moles. I need to take it's value and store it in the database and then draw it later for the highscore table. It also needs to place the scores correctly(the highest being at the top of course) Functionality for being able to store player n开发者_开发知识库ame would be nice but not necessary. Can anyone give me an example of this? My counter code is

document.getElementById("randomdiv"+r).onclick = function() {
            counter.innerHTML = parseInt(counter.innerHTML) + 1;
        }

It's displayed on the page via this code

<div id='counter'>0</div>

Thanks!


You can find many resources on the net. Some useful resources might be:

  • HTML Database tutorial

  • Answer about Browser compatibility

The first link will give you a deep overview on how to implement/use HTML 5 database feature.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜