如何更新函數外的變量?例如,我有這樣的:jquery變量外函數
var max_index = 0;
//loop through the z-index's
$(".widget_container").each(function(){
if($(this).attr("z-index") > max_index){
max_index = $(this).attr("z-index") + 1;
}
});
alert(max_index);
與此唯一的問題是max_index
總是提醒0
。我怎麼能更新max_index
?
感謝對不起我不是想笑。謝謝您的幫助 – ngreenwood6 2009-10-30 03:13:10