JS Numeric input Control

Source: Internet
Author: User

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:0px; "/>

Integer: <input type= "text"  name= "AAA"  onkeypress= "return event.keycode>=48 & & event.keycode<=57 | |  event.keycode==45 "     onblur=" isnum (this, ' numeric format is incorrect! ', 0) '  /><br/> Positive integers: <input type= "text"  name= "BBB"  onkeypress= "return event.keycode>=48 & & event.keycode<=57 " /><br/> real numbers: <input type=" text " name=" CCC "  onkeypress= "return event.keycode>=48 && event.keycode<=57 | |  event.keycode==46| |  event.keycode==45 "     onblur=" isnum (this, ' numeric format is incorrect! ', 0) '  /><br/> Positive real numbers: <input type= "text"  name= "ddd"  onkeypress= "return event.keycode>=48 & & event.keycode<=57 | |  event.keycode==46 "     onblur=" isnum (this, ' numeric format is incorrect! ', 0) '/><script  Type= "Text/javascript" >/*    &nbSP; Determines whether an object is numeric.      obj: Text box,      info: Error message,      DefaultValue: The default value given after the error   */function isnum (obj,info,defaultvalue) {    if ( defaultvalue==undefined)      {          Defaultvalue=0;     }        if (IsNaN ( Obj.value))     {//non-numeric          alert (info);          obj.value=defaultValue;          obj.focus ();     }    if (obj.value== "")      {        obj.value=defaultValue;         obj.focus ();    }}</script>

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:0px; "/>


JS Numeric input Control

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.