The code copy is as follows:
<span style="font-family: Arial, Helvetica, sans-serif;"><input type="password" name="password" id="password" onkeydown="return banInputSapce(event);" onKeyup="return inputSapceTrim(event,this);" /></span>
The code copy is as follows:
/**
* Whether to remove all spaces
* @param str
* @param is_global if all
* @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;
}
The code copy is as follows:
/**
* Space input removal
* @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;
}
The code copy is as follows:
/**
* Disable space input
* @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;
}