js入力ボックスに数値を入力するときにすべてのスペースを除去し、スペースの入力を禁止します.


/**
 *         
 * @param str
 * @param is_global    g  G     
 * @returns
 */
function Trim(str,is_global)
{
    var result;
    result = str.replace(/(^\s+)|(\s+$)/g,"");
    if(is_global.toLowerCase()=="g")
    {
        result = result.replace(/\s/g,"");
     }
    return result;
}
/**
 *       
 * @param e
 * @returns {Boolean}
 */
function inputSapceTrim(e,this_temp) 
{
	this_temp.value = Trim(this_temp.value,"g");
	var keynum;
	if(window.event) // IE 
	{ 
		keynum = e.keyCode 
	} 
	else if(e.which) // Netscape/Firefox/Opera 
	{ 
		keynum = e.which 
	}
	if(keynum == 32){
		return false;
	}
	return true;
}
/**
 *       
 * @param e
 * @returns {Boolean}
 */
function banInputSapce(e) 
{
	var keynum;
	if(window.event) // IE 
	{ 
		keynum = e.keyCode 
	} 
	else if(e.which) // Netscape/Firefox/Opera 
	{ 
		keynum = e.which 
	}
	if(keynum == 32){
		return false;
	}
	return true;
}