问题描述
我创建了一个包含多个输入字段的表单。在我的
表单的开头,我使用一组单选按钮来确定如何验证表单
以及确定需要哪些字段。因为表格是如此冗长,我希望通过包含关于哪些字段
需要信息的视觉线索来帮助用户,方法是将该字段的背景颜色更改为红色。我
了解如何按字段完成此字段,但是,我正在寻找
更简单的方法。相反,写一个大乱的函数,为每一个字段声明
(document.form.name.style.backgroundColor =''red''),我会
喜欢能够一次将这个命令广播到几个选定的领域。
任何建议都将不胜感激。
最好的问候,
Martin Franklin
-
I''ve created a form with several input fields. At the beginning of my
form I use a set of radio buttons to determine how to validate the form as
well as determine what fields are required. Because the form is so lengthy,
I would like to aid users by including visual clues as to what fields
require information by changing the background color of that field to red. I
understand how to accomplish this field by field however, I am looking for
an easier way. Rather that write a big messy function which declares
(document.form.name.style.backgroundColor=''red'') for every single field, I''d
like to be able to broadcast this command to several chosen fields at once.
Any suggestion would be greatly appreciated.
Best Regards,
Martin Franklin
--
MA********@cox.net
推荐答案
不是很了解,但也许:
<输入类= QUOT;需" ...
Didn''t understand very well, but maybe :
<input class="required" ...
为什么不把表单分成两步呢?在第一步中,他们选择一个
单选按钮并提交表单。根据选择哪个单选按钮
,他们会在第二步中获得不同的表格。
-
Chris
Why not make the form two steps? In the first step, they select a
radio button and submit the form. Depending on which radio button is
selected, they get a different form in the second step.
--
Chris
这篇关于动态Web表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!