用户输入字符时显示错误 [英] display error when user input character

查看:64
本文介绍了用户输入字符时显示错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一下如何防止或显示警报,用户不能在我的文本字段中输入任何字符,因为我希望用户仅在该文本字段中输入数字.

任何帮助都非常感激. :)

i would like to ask on how to prevent or display alert that user must not input any character in my text field because i want user just to input numbers in that text field.

any help are much appreciated. :)

推荐答案

http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric [ ^ ]

如果我误解了您的问题,请随时纠正我.
http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric[^]

If i misunderstand your question, please feel free to correct me.


u可以使用javascript来实现

使用
u can use javascript for tat

Use
var attendees = "Four members present";
// Ensure that the value is numerical
if( isNaN(attendees) )
    alert("Please enter a number for the number of attendees.");

该功能
问候
拉吉

function for that
Regards
Raj


这篇关于用户输入字符时显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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