---
title: "Asp关于限制TextBox输入的问题"
author: "piperzero"
date: "2013-02-21T18:28:00Z"
tags: []
slug: "asp-textbox"
draft: false
lastmod: "2013-02-21T19:49:17Z"
id: 1811346
url: "https://piperzero.iteye.com/blog/1811346"
---

1、限制文本框只能输入数字

onkeyup=“if(isNaN(value))execCommand('undo')”

onafterpaste="if(isNan(value)) execCommand('undo')"

2、限制文本框只能输入小数点

onkeypress="if(event.keyCode!=46)event.returnValue=fasle;"