如何在网页上输入数据时限制用户 [英] How to restrict user while entering the data on Webpage

查看:76
本文介绍了如何在网页上输入数据时限制用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts,



我有网页,用户输入姓名,电子邮件,电话号码等数据。如何限制用户在输入时只在名称字段中输入名称。

例如:名称:abc123 ---应该说在进入下一个控制之前输入正确的名称

电子邮件:

电话:



怎么做?

解决方案

您可以尝试更简单的技术,如 tabindex 验证,以控制此类交互。



但是,如果您必须强制执行一系列活动,则可以使用 JavaScript / jQuery 类型函数对您喜欢的序列中的控件值进行验证,然后如果有任何控件有一个空值,将焦点设置在该控件上并退出该函数。



此功能可以在控件的选项卡输出事件和页面加载事件上触发页面。




希望这对你有用。



你可以使用正则表达式,为了更好地理解一些例子。







正则表达式(Mozila)< a href =https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions>



& [ ^ ]





[ ^ ]

http://stackoverflow.com/questions/46155/validate-email-address-in-javascript [ ^ ]

Hello Experts,

I have web page that user inputs the data like Name, email, phone number. How can I restrict the user to enter only name in name field while entering.
Ex: Name: abc123--- It should say enter proper name before going to next control
Email:
Phone:

How to do this?

解决方案

You can try easier techniques like tabindex and validations for the input controls to control this type of interactions.

But if you absolutely have to enforce a set sequence of activities, you could use a JavaScript/jQuery type function that does a validation on the values of the controls in the sequence you like and then if any control has an empty value, set the focus on that control and exits the function.

This function could be triggered on tab out events for the controls and on page load event for the page.


hi,
hope this will help full for you.

You can use Regular Expressions, for your better understating some examples are here.



Regular Expressions (Mozila)

&
[^]


[^]
http://stackoverflow.com/questions/46155/validate-email-address-in-javascript[^]


这篇关于如何在网页上输入数据时限制用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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