Digital verification control

Source: Internet
Author: User

Integer: < ASP: textbox ID = Rel_level Borderwidth = "0px" Runat = "Server" Onkeyup = "If (event. keycode! = 37 & event. keycode! = 39) value = value. Replace (/\ D/g ,'');" Height = "18px" Width = "55px"   > </ ASP: textbox >
Data:
< ASP: textbox Onkeypress = "If (! This. value. Match (/^ [\ + \-]? \ D *? \.? \ D *? $/) This. value = This. t_value; else this. t_value = This. value; If (this. value. Match (/^ (? : [\ + \-]? \ D + (? : \. \ D + )?)? $/) This. o_value = This. Value"
ID = "Tbxwork_time" Onblur = "If (! This. value. Match (/^ (? : [\ + \-]? \ D + (? : \. \ D + )? | \. \ D *?)? $/) This. value = This. o_value; else {If (this. value. match (/^ \. \ D + $/) This. value = 0 + this. value; If (this. value. match (/^ \. $/) This. value = 0; this. o_value = This. value }"
Onkeyup = "If (! This. value. Match (/^ [\ + \-]? \ D *? \.? \ D *? $/) This. value = This. t_value; else this. t_value = This. value; If (this. value. Match (/^ (? : [\ + \-]? \ D + (? : \. \ D + )?)? $/) This. o_value = This. value; javascript: Stat (this. Value );"
Runat = "Server" > </ ASP: textbox > Code
< ASP: textbox ID = "Tbxbudmoney" Width = "80px" Runat = "Server" Style = "Font-size: 9pt; Border: 1px solid #003390; font-style: normal ;" Onkeyup = "Clearnonum (this )" Onchange = "Clearnonum (this )" > </ ASP: textbox >
// The limit can only contain numbers.
Function clearnonum (OBJ)
{
OBJ. value = obj. value. Replace (/[^ \ D.]/g, ""); // leave the non-numeric and point empty
OBJ. value = obj. value. Replace (/^ \./g, ""); // the first digit of the warranty is not a point
OBJ. value = obj. value. Replace (/\. {2,}/g, "."); // there is only one. No more.
OBJ. value = obj. value. replace (". "," $ # $ "). replace (/\. /g ,""). replace ("$ # $ ",". "); // warranty. only once, but not more than twice
// The following warranty can have only two small numbers
VaR curvalue = obj. value;
If (curvalue. lastindexof ('.')> = 0)
{
If (curvalue. Split ('.') [1]. length> 2)
{
Curvalue = curvalue. substr (0, curvalue. lastindexof ('.') + 3 );
OBJ. value = curvalue;
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.