1.文本框只能输入数字代码(小数点也不能输入): input onkeyup="this.value=this.value.replace(//D/g,'')" onafterpaste="this.value=this.value.replace(//D/g,'')" 2.只能输入数字,能输小数点. (方法1) input onkeyup="if(isNaN(value))execCommand('undo'
1.文本框只能输入数字代码(小数点也不能输入):
2.只能输入数字,能输小数点. (方法1)
3.数字和小数点方法二
4.只能输入字母和汉字
5.只能输入英文字母和数字,不能输入中文
6.只能输入数字和英文
7.小数点后只能有最多两位(数字,中文都可输入),不能输入字母和运算符号:
8.小数点后只能有最多两位(数字,字母,中文都可输入),可以输入运算符号:
调用onkeypress事件实现 限制文本框只能输入数字及小数点(并且只能输入1次)
function KeyPress(objTR)
{
var txtval = objTR.value;
var key = event.keyCode;
if((key 57)&&key !=46)
{
event.keyCode = 0;
}
else
{
if(key == 46)
{
if(txtval.indexOf(".") != -1 || txtval.length == 0)
event.keyCode = 0;
}
}
}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function