The article has a collection of JS input can only enter a number (compatible with IE and Firefox) is regular, the front two is online to find but seems to not support Ie,firefox regular, and later a very beautiful compatible with multiple browsing the regular method ha.
Only numbers can be entered
<input onkeyup= "value="/value.replace (/["^d]/g") "Onbeforepaste=" Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text '). Replace (/[^d]/g, ') "> You can only enter a number to lose a decimal point.
<inputōnkeyup= ' if (isNaN (value)) ExecCommand (' Undo ') ' ōnafterpaste= ' if (isNaN (value)) ExecCommand (' Undo ') > <input name=txt1ōnchange= "if (/d/.test (this.value)) {alert (' can only enter a number '); this.value= ';} ' > To see a number of instances that can only be entered Input can only enter the number of online search is for IE, wrote a generic. Using a jquery method to determine if IE is not
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.