表格验证问题 [英] Form validation question

查看:64
本文介绍了表格验证问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网页上有一个表单,并希望对

表单字段使用JavaScript验证。

我在网上搜索了表单验证脚本并且已经出现了使用

脚本只验证单个字段,例如电子邮件验证

脚本或者电话验证脚本。

是否可以将所有这些脚本放在页面上,或者它们应该是什么?

以某种方式连接成一个脚本?

我是一个JavaScript新手,我完全迷失了。


感谢阅读!

I have a form on a webpage and want to use JavaScript validation for the
form fields.
I have searched the web for form validation scripts and have come up with
scripts that only validate individual fields, such as an "Email Validation
Script" or a "Phone Validation Script".
Is it ok to put all these scripts on page as they are or should they be
joined in some way together to be one script?
I''m a total JavaScript newbie and am completely lost.

Thanks for reading!

推荐答案

Hosh写于22 okt 2005 comp.lang.javascript
Hosh wrote on 22 okt 2005 in comp.lang.javascript:
我在网页上有一个表格并且想要在表单字段中使用JavaScript验证。
我在网上搜索表单验证脚本,并且已经出现了仅验证单个字段的脚本,例如Email 是否可以将所有这些脚本放在页面上,或者它们是否应该以某种方式连接成一个脚本?


..............

功能验证(x){

//这取决于你的要求

firstInput = x.blah.value

................

}

< / script>


............

< form onsubmit =''return validate(this)''>

< input name =''blah''..........

我是一个JavaScript新手,我完全迷失了。
I have a form on a webpage and want to use JavaScript validation for
the form fields.
I have searched the web for form validation scripts and have come up
with scripts that only validate individual fields, such as an "Email
Validation Script" or a "Phone Validation Script".
Is it ok to put all these scripts on page as they are or should they
be joined in some way together to be one script?
..............
function validate(x){
// this depends on your requirements
firstInput = x.blah.value
................
}
</script>

............
<form onsubmit=''return validate(this)''>
<input name=''blah'' ..........
I''m a total JavaScript newbie and am completely lost.




学习或雇用某人。验证不是初学者的工作。


-

Evertjan。

荷兰。

(用我的电子邮件中的点替换所有十字架)



Learn or hire someone. Validating is not a beginners job.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


谢谢你。
Thanks for that.
学习或雇用某人。验证不是初学者的工作。
这就是计划(学习)。这就是为什么我在这里。

Evertjan。 <前************** @ interxnl.net>在消息中写道

新闻:Xn ******************** @ 194.109.133.242 ... Hosh写于22 okt 2005 in comp。 lang.javascript
Learn or hire someone. Validating is not a beginners job. That''s the plan (learn). That''s why I''m here.
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242... Hosh wrote on 22 okt 2005 in comp.lang.javascript:
我在网页上有一个表单,想要对表单字段使用JavaScript验证。
我已经在网页上搜索了表单验证脚本,并且已经出现了仅验证单个字段的脚本,例如电子邮件验证脚本和电子邮件验证脚本。或电话验证脚本。
是否可以将所有这些脚本放在页面上,或者它们是否应该以某种方式连接成一个脚本?
I have a form on a webpage and want to use JavaScript validation for
the form fields.
I have searched the web for form validation scripts and have come up
with scripts that only validate individual fields, such as an "Email
Validation Script" or a "Phone Validation Script".
Is it ok to put all these scripts on page as they are or should they
be joined in some way together to be one script?

//这取决于您的要求
firstInput = x.blah。价值
................
}
< / script>

....... ....
< form onsubmit =''return validate(this)''>
< input name ='''blah''..........



.............
function validate(x){
// this depends on your requirements
firstInput = x.blah.value
................
}
</script>

...........
<form onsubmit=''return validate(this)''>
<input name=''blah'' ..........

我是一个JavaScript新手,我完全迷失了。
I''m a total JavaScript newbie and am completely lost.



学习或雇用某人。验证不是初学者的工作。

- Evertjan。
荷兰。
(用我的电子邮件中的点替换所有十字架)



Learn or hire someone. Validating is not a beginners job.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)



Hosh在comp.lang.javascript 上写了23 okt 2005:
Hosh wrote on 23 okt 2005 in comp.lang.javascript:
" Evertjan。 <前************** @ interxnl.net>写在消息
"Evertjan." <ex**************@interxnl.net> wrote in message
Hosh写于22 okt 2005 comp.lang.javascript
Hosh wrote on 22 okt 2005 in comp.lang.javascript:
我在网页上有一个表格并希望对表单字段使用JavaScript验证。
我在网上搜索了表单验证脚本,并且已经出现了仅验证单个字段的脚本,例如电子邮件
验证脚本或者电话验证脚本。
是否可以将所有这些脚本放在页面上,或者它们是否应该以某种方式连接成一个脚本?
.. ...........
功能验证(x){
//这取决于您的要求
firstInput = x.blah.value
...... ...............
< / script>

...........
< form onsubmit =''return validate(this)''>
< input name =''blah''..........
I have a form on a webpage and want to use JavaScript validation for
the form fields.
I have searched the web for form validation scripts and have come up
with scripts that only validate individual fields, such as an "Email
Validation Script" or a "Phone Validation Script".
Is it ok to put all these scripts on page as they are or should they
be joined in some way together to be one script?
.............
function validate(x){
// this depends on your requirements
firstInput = x.blah.value
................
}
</script>

...........
<form onsubmit=''return validate(this)''>
<input name=''blah'' ..........
我是一个全新的JavaScript新手,我完全迷失了。
I''m a total JavaScript newbie and am completely lost.



学习或雇用某人。验证不是初学者的工作。



Learn or hire someone. Validating is not a beginners job.




[首先要学习的东西:请不要在usenet上使用,请]

谢谢为此。



[first thing to learn: do not toppost on usenet, please]
Thanks for that.

学习或雇用某人。验证不是初学者的工作。
Learn or hire someone. Validating is not a beginners job.


这是计划(学习)。这就是为什么我在这里。


That''s the plan (learn). That''s why I''m here.




然后,我们不会在编程中做你的工作,做一些不用的事情

编程是一项专业工作,但是如果你提供一些代码,那么你会得到所有你想要的帮助。


正如我在上面向您展示的那样,在验证中设置您的目标,并尝试制作一些

代码,在我展示的框架中测试它,或者更好的计划,我你

有一个,然后进行测试。


然后回答你的问题。


你读过这个NG的常见问题并存档吗?


主要常见问题:

< http://jibbering.com/faq/>


次要常见问题:

< http://www.merlyn.demon.co.uk/js-index.htm>


存档:

< http://groups.google.com/group/comp.lang.javascript>

-

Evertjan。

荷兰。

(用我的点替换所有带点的十字架emailaddress)



Then, we are not going to do your job in programming, doing sonone elses
programming is a professional job, but if you supply a bit of code you
are troubled with, you usually will get all the help you could wish.

As I showed you above, set your goals in validation and try to make some
code, test it in the framework I showed bove, or a better plan, I you
have one, and test it.

Then return with your problems.

Did you read this NG''s FAQ and archive yet?

primary faq:
<http://jibbering.com/faq/>

secondary faq:
<http://www.merlyn.demon.co.uk/js-index.htm>

archive:
<http://groups.google.com/group/comp.lang.javascript>
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


这篇关于表格验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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