形式验证功能 [英] form validating function

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

问题描述

请检查我的测试页面的来源: http://tnij.org/mytest

为什么它在IE和Opera中是如此愚蠢?我只想在字段模糊且没有输入值时显示警告
显示警告并且我希望JS在该字段上执行函数focus()。我想不允许用户

一旦他进入该字段就将该字段留空。希望你知道我的b $ b意思是什么,看看源头。它只适用于Forefox。对IE的警告和

Opera用户:如果你使用ctrl + alt + del来关闭你的浏览器

模糊任何字段:(


问候,

mk

Please, check the source of my test page: http://tnij.org/mytest
Why is it working is such a stupid way in IE and Opera ? I just want to
display alert when field is blurred and it has no value entered and than I
want JS to execute function focus() on that field. I want not to allow user
to leave the field empty once he enters that field. Hope you know what I
mean, look in the source. It works ok in Forefox only. Warning to IE and
Opera users: you''ll have to use ctrl+alt+del to close your browser if you
blur any field :(

Regards,
mk

推荐答案



U? ytkownik" Lee"< RE ************** @ cox.net> napisa3 w wiadomo?ci

news:e1 ******* ** @ drn.newsguy.com ...

U?ytkownik "Lee" <RE**************@cox.net> napisa3 w wiadomo?ci
news:e1*********@drn.newsguy.com...
这是预期的行为。


我根本不明白为什么但是好的,我相信你:)

这只是你不应该尝试这种模糊验证的原因之一。
That''s expected behavior.
I don''t understand at all why but ok, I believe you :)
It''s only one of the reasons why you should never try this sort
of validation on blur.




那么,您如何建议解决验证?


感谢您的回复,

mk



So, how do you suggest to solve the validation ?

Thanks for reply,
mk


mk写道:
这只是你不应该尝试这种模糊验证的原因之一。
It''s only one of the reasons why you should never try this sort
of validation on blur.


那么,你怎么建议的est解决验证?


So, how do you suggest to solve the validation ?




使用onChange而不是onBlur。


-

Matt Kruse
http://www.JavascriptToolbox.com
< a rel =nofollowhref =http://www.AjaxToolbox.comtarget =_ blank> http://www.AjaxToolbox.com


mk写道:
U?ytkownik" Lee" < RE ************** @ cox.net> napisa3 w wiadomo?ci
新闻:e1 ********* @ drn.newsguy.com ...
U?ytkownik "Lee" <RE**************@cox.net> napisa3 w wiadomo?ci
news:e1*********@drn.newsguy.com...



[...]


[...]

这只是你不应该尝试这种模糊验证的原因之一。
It''s only one of the reasons why you should never try this sort
of validation on blur.



那么,您如何建议解决验证?


So, how do you suggest to solve the validation ?




将错误消息写入页面中的字段,不要使用警报。

-

Rob



Write error messages to fields in the page, don''t use alerts.
--
Rob


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

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