---
title: "JS  只输入数字"
author: "maxwell"
date: "2008-10-13T13:50:30Z"
tags: []
slug: "js"
draft: false
lastmod: "2008-10-13T13:50:30Z"
id: 252148
url: "https://maxwell.iteye.com/blog/252148"
---

&lt;input onkeyup="value=value.replace(/\[^\\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\[^\\d]/g,''))"&gt;