仅接受数值 [英] Accept only numeric value
本文介绍了仅接受数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请让我知道如何完成以下任务 -
要求用户输入一个数字。
检查用户是否仅输入了数字值。如果他/她输入0-9以外的任何字符,它应该打印出错误。
谢谢,
Karthik
Hi,
Please let me know how I can accomplish the following task -
"Ask the user to enter a number".
Check whether the user has entered only numeric values. If he/she enters any character other than 0-9, it should print out an error.
Thanks,
Karthik
推荐答案
到目前为止您尝试了什么?
What have you tried so far?
本网站的专家非常乐意帮助您解决问题,但他们无法完成您的任务/程序给你。首先尝试自己的作业/计划并发布有关您遇到的任何困难或有关您不知道如何实现的特定代码功能的问题。
请阅读< a href =http://www.thescripts.com/forum/faq.php?faq=posting_guidelines\"target =_ blank>发布指南,特别是课程作业发布指南。
然后当你准备发布一个新的这个帖子中的问题。
MODERATOR
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don''t know how to achieve.
Please read the Posting Guidelines and particularly the Coursework Posting Guidlines.
Then when you are ready post a new question in this thread.
MODERATOR
karthick
去w3schools或tizag.com和int那些网站去如果您需要仅使用数字验证表单字段,或者尝试将现在执行的示例代码复制到此论坛,请通过javascript教程。
以便人们可以帮助您清楚..
问候,
Lastknight
karthick
go to w3schools or tizag.com and int that sites go through the javascript tutorial if u need to validate the form field only with numbers or else try to copy a sample code ur doing now in to this forum.
So that people can help u clearly..
regards,
Lastknight
这篇关于仅接受数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文