在JavaScript結果的整數我試圖調試,但我就是不明白,爲什麼變量DISP收益爲NaN的,每當我一個加一。如果任何人可以闡明爲什麼會發生這種情況,我會感激十倍。遞增NaN的
var votePages = new Array();
votePages[0] = "http://minecraftservers.org/vote/100924";
votePages[1] = "http://www.planetminecraft.com/server/revolutionarycraft---ssdfactionsecosurvivalgrief/vote/";
votePages[2] = "http://minecraftservers.net/server/66267/vote/";
votePages[3] = "http://mineservers.com/server/11885/vote";
votePages[4] = "https://minestatus.net/92187-revolutionary-craft/vote";
var disp = 0;
$("#dispVotePage").attr("src", votePages[disp]);
$(document).on('click', '#next', function(){
$("#dispVotePage").attr("src", '');
var disp = disp++;
alert(disp);
$("#dispVotePage").attr("src", votePages[disp]);
if (disp !== 0) {
$("#previous").css('display', 'block');
}
});
$(document).on('click', '#previous', function(){
$("#dispVotePage").attr("src", '');
var disp = disp--;
$("#dispVotePage").attr("src", votePages[disp]);
if (disp === 0) {
$("#previous").css('display', 'none');
}
});
你會看到我在那裏有alert(disp),它用於調試目的。的disp
var disp = disp ++;使用不同的變量名稱。 – Akshay