我需要一些基于 javascript 的代码来帮助我的投票系统。基本上,我正在努力研究如何让我的收到投票的物品自行进入订单状态。因此,如果一个项目有 52 票,而下面的项目获得 2 票,得到 54 票,我希望它与上面的 1 交换位置。
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Vote!</title>
<style>
#counting {
font-family:avante;
font-size:20px;
border:0px;
}
#counting1 {
font-family:avante;
font-size:20px;
border:0px;
}
</style>
<script type="text/javascript">
function countClicks() {
var x = 0;
x += 1
document.getElementById( "counting" ).value = x;
var clickLimit = 1; //Max number of clicks
if(x>=clickLimit) {
}
else
{
ClickCount++;
return true;
}
}
</script>
<script type="text/javascript">
function countClicks1() {
var x = 0;
x += 1
document.getElementById( "counting1" ).value = x;
var clickLimit = 1; //Max number of clicks
if(x>=clickLimit) {
}
else
{
ClickCount++;
return true;
}
}
</script>
</head>
<body>
<img src="../Pictures/BWS + L.A +KUSH/Game.RED_Album_Cover.jpg" alt="red album"><br>
<input type="button" value="VOTE" name="clickOnce" onclick="return countClicks();" /> <br>
<input id="counting" type="text">
<br>
<br>
<img src="../Pictures/BWS + L.A +KUSH/Game.RED_Album_Cover.jpg" alt="red album"><br>
<input type="button" value="VOTE" name="clickOnce" onclick="return countClicks1();" /> <br>
<input id="counting1" type="text">
</body>
</html>