日期:2014-05-16 浏览次数:20456 次
function changeImg(num,obj)
{
if(num<100)
obj.src='1.gif';
else if(num>=100&num<200)
obj.src='2.gif';
else
obj.src='3.gif';
}
var num = 199,
maxNum = 3,
imgNum = Math.ceil(num/100);
if(imgNum <= maxNum){
console.log(imgNum);
}else{
console.log(maxNum);
imgNum = maxNum;
}
//然后用imgNum进行加载图片
num<200?(num<100?"1.gif":"2.gif"):"3.gif";