我会对评论,建议的改进等感兴趣。 特别是我忽略的任何跨浏览器的Javascript方面。 (我试过了Opera 7中的页面,Mozilla 1.1,IE 6,NN4)。 - Stephen Poley http://www.xs4all.nl/~sbpoley/webmatters/I have quite often (as have probably many of you) come across HTML formswith irritating bits of Javascript attached. The last straw on thisparticular camel''s back was a large form I was asked to complete inconnection with attendance at a seminar. After spending more than 15minutes on it, I clicked on the submit button - and nothing happened.Looking round the pages on Javascript form validation that Googleproduced for me (well, 15-20 of them!), none seemed to emphasise thepoints that I feel to be important. And some even advocated badpractices. So I decided to stick my neck out and produce a page on howit ought to be done: http://www.xs4all.nl/~sbpoley/webmatters/formval.htmlI would be interested in comments, suggested improvements etc. Inparticular any cross-browser Javascript aspects I have overlooked.(I''ve tried the page in Opera 7, Mozilla 1.1, IE 6, NN4).--Stephen Poley http://www.xs4all.nl/~sbpoley/webmatters/推荐答案在帖子< news:e4 ************************ ********@4ax.com> Stephen Poley说:in post <news:e4********************************@4ax.com >Stephen Poley said:我经常(很可能你们很多人)遇到了令人烦恼的Javascript附加的HTML表单。这个特别是驼背的最后一根稻草是一个很大的形式,我被要求完成与出席研讨会的关系。花了超过15分钟后,我点击了提交按钮 - 没有任何反应。 根据我的经验,这是正常行为。我总是对形状设计有多糟糕感到惊讶。创作者不会想到。 http: //www.xs4all.nl/~sbpoley/webmatters/formval.html I have quite often (as have probably many of you) come across HTML forms with irritating bits of Javascript attached. The last straw on this particular camel''s back was a large form I was asked to complete in connection with attendance at a seminar. After spending more than 15 minutes on it, I clicked on the submit button - and nothing happened.in my experience thats normal behavior. i''m constantly amazed at how badform design is. the creators just don''t think. http://www.xs4all.nl/~sbpoley/webmatters/formval.html 非常好。在你提到尾随空格的地方,你可能想添加 换行,这在复制/粘贴时并不少见(最近 经验,花了我很多年的时间来锻炼为什么我的文字被拒绝了) NS4.76: http://stuff.bruciesusenetshit.info/screencap09.png [35k] - brucie 05 / December / 2003 05:37:51 pm kilovery good. where you mention trailing whitespace you may like to addline breaks as well which isn''t uncommon when copy/pasting (recentexperience, took me ages to work out why my text was being rejected)NS4.76: http://stuff.bruciesusenetshit.info/screencap09.png [35k]--brucie05/December/2003 05:37:51 pm kilo " Stephen Poley" < SB ***** @ xs4all.nl>在消息中写道 新闻:e4 ******************************** @ 4ax.com ..."Stephen Poley" <sb*****@xs4all.nl> wrote in messagenews:e4********************************@4ax.com...我经常(很可能你们很多人)遇到过各种各样有趣的Javascript格式的HTML表单。这个特别是驼背的最后一根稻草是一个很大的形式,我被要求完成与出席研讨会的关系。在花了超过15分钟后,我点击了提交按钮 - 没有任何反复发生。 围绕Google为我生成的Javascript表单验证页面(好吧,其中15-20个!),似乎没有人强调我觉得重要的要点。有些人甚至主张糟糕的做法。所以我决定把我的脖子伸出来,制作一个关于它应该如何完成的页面: http://www.xs4all.nl/~sbpoley/webmatters/formval.html 我会感兴趣的评论,建议的改进等。特别是我忽略的任何跨浏览器的Javascript方面。(我已经尝试过Opera 7,Mozilla 1.1,IE 6,NN4中的页面)。 I have quite often (as have probably many of you) come across HTML forms with irritating bits of Javascript attached. The last straw on this particular camel''s back was a large form I was asked to complete in connection with attendance at a seminar. After spending more than 15 minutes on it, I clicked on the submit button - and nothing happened. Looking round the pages on Javascript form validation that Google produced for me (well, 15-20 of them!), none seemed to emphasise the points that I feel to be important. And some even advocated bad practices. So I decided to stick my neck out and produce a page on how it ought to be done: http://www.xs4all.nl/~sbpoley/webmatters/formval.html I would be interested in comments, suggested improvements etc. In particular any cross-browser Javascript aspects I have overlooked. (I''ve tried the page in Opera 7, Mozilla 1.1, IE 6, NN4). Hnmm。这是一个非常好的主意。 以及javascript的优秀用途 - *增强*什么是已经 的工作页面。 < story> 遇到一些我认为可能喜欢的软件。演示下载需要 填写一个包含所有常见侵入性问题的表格。大约二十美元 。 在底部是标准地址字段,其中包含<恼人的>下降 国家选择< /烦恼>。所以,填写完整的表格后我将把国家从默认的美国(当然)改为澳大利亚。 立即换新的国际表单填充我的画布,你可能会猜测,所有字段都是空白的。 我找到了一些更合适的软件: - ) < / story> < gripe> 你提到要做多少验证。我想你应该添加一个部分 给出更多*不*做的例子。 我被要求在计算机上回答一次问题在所有地方,一个 滑雪租赁店(准备好了)美国的A. Mammoth确切地说。这台 计算机坚持我的邮政编码(他们称之为邮政编码)必须是5美元长的b / b 。我的邮政编码是2154.当然我撒了谎。 同样的表格坚持我的电话号码必须是555 555 555(IIRC)。 我的是+61 2 5555 5555.我再次撒谎。 同样的形式有一个<恼人的>下拉状态选择< /烦恼>。新南威尔士州不在那里,只有CA,CO,NY等等。不用说我和其他5个澳大利亚人和我一起撒谎。 > 他们的人口统计数据如此之多:-) < / gripe> 干杯 理查德。Hnmm. What a terribly good idea.And, what an excellent use of javascript - to *enhance* what is an alreadyworking page.<story>Came across some software I thought I might like. The demo download requiredfilling in a form with all the usual intrusive questions. Some twenty ofthem.Right at the bottom is the standard address fields with the <annoying> dropdown country selection </annoying>. So, having filled in the entire form Ichange the country from the default USA (of course) to Australia.Immediately a new "international" form fills my canvas, with, as you mayguess, all of the fields blank.I found some more suitable software :-)</story><gripe>You mention how much validation to do. I think you should add a sectiongiving some more examples of what *not* to do.I was required to answer questions once on a computer at, of all places, aski rental shop in (you guessed it) the U S of A. Mammoth to be exact. Thiscomputer insisted my postcode (they called it a zip code) had to be exactly5 digits long. My postcode is 2154. Of course I lied.Same form insisted my phone number must be of the form 555 555 555 (IIRC).Mine is +61 2 5555 5555. I lied again.Same form had an <annoying> drop down state selection </annoying>. NSW wasnot in there, just things like CA, CO, NY etc. Needless to say I, and theother 5 Australians with me, lied.So much for their demographics :-)</gripe>CheersRichard.> http://www.xs4all.nl/~sbpoley/webmatters/ formval.html 我会对评论,建议的改进等感兴趣。特别是我忽略了任何跨浏览器的Javascript方面。 (我已经尝试过Opera 7,Mozilla 1.1,IE 6,NN4中的页面。) I would be interested in comments, suggested improvements etc. In particular any cross-browser Javascript aspects I have overlooked. (I''ve tried the page in Opera 7, Mozilla 1.1, IE 6, NN4). 非常好主意 - 我正在考虑注册表格我现在正在创建 ,并且正在考虑添加焦点变化和警报等功能,但决定反对它,因为它会惹恼用户并干扰 他们在页面上的动作......也许你可以在某些方面工作 - 除非 有人对于为什么应该包括它们有任何想法(即警报框) Nicko。Very good idea - I was putting thought into a sign-up form i''m creating atthe moment and was thinking of adding features like focus changes and alertboxes but decided against it because it annoys users and interferes withtheir movements on the page... maybe you can work that in some how - unlesssomeone has any ideas as to why they should be included (ie. the alert boxin your first example form)Nicko. 这篇关于Javascript表单验证 - 请注意的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!