<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>input只能输入数字</title> </head> <body> <input type="text"oninput="value=value.replace(/[^d]/g,'')"> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>input只能输入数字</title> </head> <body> <input type="text"oninput="value=value.replace(/[^d]/g,'')"> </body> </html>