A
Abhishek
Hi I have tried one more javascript Validator Script to Validate the
Money entered in to the TextBox.
<script language='javascript'>
function checkNumber(val,e){
if(window.event){
var strkeyIE = e.keyCode
if(((strkeyIE >= 48) && (strkeyIE <= 57 )) || (strkeyIE == 44) ||
(strkeyIE == 36) ){}
else{
return false;}}
else{
var strkeyCode = e.keyCode
var strCharCode = e.charCode
if(((strCharCode >= 48) && (strCharCode <= 57 )) || (strCharCode ==
44) || (strCharCode==36)|| (strkeyCode==37 )|| (strkeyCode==38) ||
(strkeyCode == 46)||(strkeyCode==8 ) || (strkeyCode ==9 ) ||
(strkeyCode==39) || (strkeyCode ==35) || (strkeyCode ==36) ||
(strkeyCode==9)){}
else{return false;} }
return true;}
function valFuncReg_Money(text,reg){
if(text == null || text == '')return true;
if(reg == null || reg =='')return true;
var regex = new RegExp(reg);var value=text;
var res= (regex.exec(text));
if(res==null){
reg =/^\$?[0-9]+$/;
regex = new RegExp(reg);
res= (regex.exec(text));}
return (res != null && value == res[0]);}
</script>
The above script can be called on "Onkeypress" event of the TextBox as
follows :
"Onkeypress", "javascript:return checkNumber(this,event);"
Please feel free to give Comments and Suggessions and Bugs also
Money entered in to the TextBox.
<script language='javascript'>
function checkNumber(val,e){
if(window.event){
var strkeyIE = e.keyCode
if(((strkeyIE >= 48) && (strkeyIE <= 57 )) || (strkeyIE == 44) ||
(strkeyIE == 36) ){}
else{
return false;}}
else{
var strkeyCode = e.keyCode
var strCharCode = e.charCode
if(((strCharCode >= 48) && (strCharCode <= 57 )) || (strCharCode ==
44) || (strCharCode==36)|| (strkeyCode==37 )|| (strkeyCode==38) ||
(strkeyCode == 46)||(strkeyCode==8 ) || (strkeyCode ==9 ) ||
(strkeyCode==39) || (strkeyCode ==35) || (strkeyCode ==36) ||
(strkeyCode==9)){}
else{return false;} }
return true;}
function valFuncReg_Money(text,reg){
if(text == null || text == '')return true;
if(reg == null || reg =='')return true;
var regex = new RegExp(reg);var value=text;
var res= (regex.exec(text));
if(res==null){
reg =/^\$?[0-9]+$/;
regex = new RegExp(reg);
res= (regex.exec(text));}
return (res != null && value == res[0]);}
</script>
The above script can be called on "Onkeypress" event of the TextBox as
follows :
"Onkeypress", "javascript:return checkNumber(this,event);"
Please feel free to give Comments and Suggessions and Bugs also