var utils = (function(){
//把类数组转换为数组(兼容所有的浏览器)
function toArray(classAry){
var ary = [];
try {
ary = Array.prototype.slice.call(classAry);
} catch (e){
for(var i = 0; i < classAry.length; i++){
ary[ary.length] = classAry[i];
}
}
return ary;
}
//把json格式的字符串转换为对象
function toJSON( str ){
return "JSON" in window ? JSON.parse( str ) : eval ('(' + str + ')');
}
return {
toJSON:toJSON,
toArray:toArray
}
})();