什么是限制可以进入一个“文本区域”的文本量的最佳方法? [英] What is the best way to limit the amount of text that can be entered into a 'textarea'?

查看:117
本文介绍了什么是限制可以进入一个“文本区域”的文本量的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是限制的文本,用户可以在网页上进入到一个文本区域字​​段中输入金额的最好方法?有问题的应用程序是ASP .NET,而是一个平台无关的答案是preferred。

What is the best way to limit the amount of text that a user can enter into a 'textarea' field on a web page? The application in question is ASP .NET, but a platform agnostic answer is preferred.

据我所知,很可能需要JavaScript的一定量的完成这件事,因为我不希望实际上如果可能的数据作为ASP .NET的量进行'后'确实有一个上限的大小要求将服务(虽然我不知道那是什么完全一致)。

I understand that some amount of javascript is likely needed to get this done as I do not wish to actually perform the 'post' with that amount of data if possible as ASP .NET does have an upper limit to the size of the request that it will service (though I don't know what that is exactly).

所以,也许真正的问题是,什么是在JavaScript中,将符合下列条件的做到这一点的最佳方式:

So maybe the real question is, what's the best way to do this in javascript that will meet the following criteria:

- 必须同样出色的工作为用户只需从其他来源的数据输入和复制/ paste'ing数据

-Must work equally well for both users simply typing data and copy/paste'ing data in from another source.

- 必须是为508合规性尽可能友好。

-Must be as '508 compliance' friendly as possible.

推荐答案

使用RegularEx pressionValidator控制在ASP.Net与与通常沿验证验证字符数

use a RegularExpressionValidator Control in ASP.Net to validate number of character along with with usual validation

这篇关于什么是限制可以进入一个“文本区域”的文本量的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆