如何將值存儲到數組或散列中,以便單獨調用而不添加單個標識符?將數值存儲在數組或哈希中從jquery選擇器重用
var myarray = [];
$(".express").each(function() {
myarray.push($(this).text());
});
function flashEXPRESS() {
$(".express").each(function() {
if ($(this).text() == 'NEW') { $(this).text() = myarray[???]; }
else { $(this).text() == 'NEW'}
});
}
var flashEXPRESSid = 0;
flashEXPRESSid = setInterval("flashEXPRESS()",1000);
無關注意:您應該將函數傳遞給'setInterval',而不是字符串。 'flashEXPRESSid = setInterval(flashEXPRESS,1000);' –