JavaScript 字符串处理
function nameToUpper()
{
if(event.keyCode > 96 && event.keyCode < 123){
event.keyCode -= 32;
}
}
function UpperString(tag)
{
var temp=document.getElementById(tag.id);
if(temp!=null)
{
document.getElementById(tag.id).value=temp.value.toUpperCase();
}
}
function clearNoNum(obj)
{
obj.value = obj.value.replace(/[^\d.]/g,"");
obj.value = obj.value.replace(/^\./g,"");
obj.value = obj.value.replace(/\.{2,}/g,".");
obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
var i=2;
var reg=new RegExp("^\\-?([0-9]\\d*|0)(\\.\\d{0,"+i+"})?$");
if(obj.value.length && !reg.test(obj.value))
{
obj.value = obj.value.substring(0,obj.value.length-1);
}
}