function
CheckNumber(txt)
... {
//Validates for ascii value between 44 and 58 which includes numericals hyphen and decimal point ascii.
if (event.keyCode > 44 && event.keyCode < 58 )
...{
//Limit all invalid acsii's other than numericals.
if (event.keyCode > 47 && event.keyCode < 48 )
...{
event.returnValue = false;
}
else
...{
event.returnValue = true;
costPerHeadEditFlag =1;
}
}
else
...{
event.returnValue = false;
}
}
... {
//Validates for ascii value between 44 and 58 which includes numericals hyphen and decimal point ascii.
if (event.keyCode > 44 && event.keyCode < 58 )
...{
//Limit all invalid acsii's other than numericals.
if (event.keyCode > 47 && event.keyCode < 48 )
...{
event.returnValue = false;
}
else
...{
event.returnValue = true;
costPerHeadEditFlag =1;
}
}
else
...{
event.returnValue = false;
}
}
function preventPaste(limitField,limitNum)
... {
var CanInsertLength;
var sData = window.clipboardData.getData("Text");
var newData ;
if(!sData.match(' '))
...{
CanInsertLength = limitNum - sData.length ;
if(CanInsertLength < 0)
...{
return false;
}
else
...{
window.clipboardData.setData("Text",sData);
return true;
}
}
else
...{
return false;
}
}
... {
var CanInsertLength;
var sData = window.clipboardData.getData("Text");
var newData ;
if(!sData.match(' '))
...{
CanInsertLength = limitNum - sData.length ;
if(CanInsertLength < 0)
...{
return false;
}
else
...{
window.clipboardData.setData("Text",sData);
return true;
}
}
else
...{
return false;
}
}
<
input
type
="text"
id
="txt1"
onpaste
="return preventPaste(this,9)"
onkeypress
="return CheckNumber(this.value)"
/>