function random (range) {
var max = Math.max( range[0], range[1] );
var min = Math.min( range[0], range[1] );
var diff = max-min+1;
var number = Math.floor( (Math.random() * diff +min) );
return number;
}
酱才可以取到[min, max]的闭区间值~
var max = Math.max( range[0], range[1] );
var min = Math.min( range[0], range[1] );
var diff = max-min+1;
var number = Math.floor( (Math.random() * diff +min) );
return number;
}
酱才可以取到[min, max]的闭区间值~
2015-11-30
为什么我的代码中和老师一样添加了 rsort()函数
//5.排序海报
function rsort(n){
var photo_center = g('#photo_'+n);
photo_center.className += ' photo_center ';}
函数之后,运行时浏览器 提示我 Cannot read property 'className' of ????
//5.排序海报
function rsort(n){
var photo_center = g('#photo_'+n);
photo_center.className += ' photo_center ';}
函数之后,运行时浏览器 提示我 Cannot read property 'className' of ????
2015-11-16