日期:2014-05-16  浏览次数:20319 次

js format方法的SRC
String.prototype.format = function(args) { 
if (arguments.length>0) { 
var result = this; 
if (arguments.length == 1 && typeof (args) == "object") { 
for (var key in args) { 
var reg=new RegExp ("({"+key+"})","g"); 
result = result.replace(reg, args[key]); 
} 
} 
else { 
for (var i = 0; i < arguments.length; i++) { 
if(arguments[i]==undefined) 
{ 
return ""; 
} 
else 
{ 
var reg=new RegExp ("({["+i+"]})","g"); 
result = result.replace(reg, arguments[i]); 
} 
} 
} 
return result; 
} 
else { 
return this; 
} 
}

?js 取得select 的选中的text

var rangeChange = function (obj) {
?alert(_NAME_ARRAY);
?// 把没选的加入array
//?alert(obj.options[obj.selectedIndex].text);
}