Hi, I am building a small site for fun, and I want to put a list on it. For every file or element in the list, I want to have two buttons. One to upvote that particular element, and one to downvote. Each element will be put in order on the list from highest number of upvotes to lowest, and I don't want any users to be able to vote more than once on each element. Does anyone know how to do this? The list should be able to display the number of votes each element has next to it. THANK YOU IN ADVANCE!
Obviously there's zero function in that script, it's just a table to demonstrate the layout a little more effectively. I think I can write the voting part and layout of the page, but I wouldn't know how to make the list order itself from high votes to low votes. Thanks a lot for the reply!
Note that JS limitations involve the inability to load/store a database. For this you will need some server-side code.
You might be able to use AJAX to read the text file (to create the 'voteResults' array)
but there is only limited storage ability in MSIE and none at all in the other browsers.
That table works very well and is exactly what I was looking for in the layout of the page, just a simple table.
However, in order for the page to save votes of users and display them on site load, what would be the best tool? For example, if "Bird" got votes, when it is reloaded, it shows 5 votes. Also, do you think I should add a log in script with sql to prevent people from voting twice on the same one? This way I could make it so only logged in users can vote. Thanks for the initial layout code, by the way.