﻿//去除所有空格
String.prototype.trim=function()
{
	return this.replace(/(^\s*)|(\s*$)/g, "");       
}       

//去除左边空格       
String.prototype.ltrim=function()
{              
	return this.replace(/(^\s*)/g,"");       
}       

//去除右边空格       
String.prototype.rtrim=function()
{               
	return this.replace(/(\s*$)/g,"");       
} 

//文本框获得焦点
function txtOnFocus(txtbox,str,clsName){
	if (txtbox.value.trim() == str){
		txtbox.value = "";
	}
	txtbox.className = clsName;
}

//文本框失去焦点
function txtLostFocus(txtbox,str,clsName){
	if (txtbox.value.trim() == ""){
		txtbox.value = str;
	}
	txtbox.className = clsName;
}

function txtKeyDown(btn)
{
	if (window.event.keyCode == 13)
	{
		btn.click();
		return false;
	}
}


