[Javascript]控制组合选择 [英] [Javascript] Control combination select
问题描述
大家好。
我应该用javascript 来操作这个控件:
首先选择:
1)Frank
2)Anthony
3)Max
4)Mark
5)Vincent
6)Jim
第二选:
1)日本
2)意大利
3)英格兰
4)美国
5)墨西哥
6)西班牙
例如,函数javascript必须阻止选择:
来自第一个Select = Frank
来自第二选择=意大利
确切的组合是:
Frank ==>日本
安东尼==>意大利
Max ==>英格兰
马克==>美国
Vincent ==>墨西哥
Jim ==>西班牙
所有其他可能的组合都是错误的。
感谢您的关注,问候
Viki
Hi all.
I should work this control with javascript:
First select:
1) Frank
2) Anthony
3) Max
4) Mark
5) Vincent
6) Jim
Second select:
1) Japan
2) Italy
3) England
4) USA
5) Mexico
6) Spain
For example, the function javascript must prevent selection is:
from the first Select = Frank
from the second Select = Italy
The exact combination is:
Frank ==> Japan
Anthony ==> Italy
Max ==> England
Mark ==> USA
Vincent ==> Mexico
Jim ==> Spain
All other possible combination is wrong.
Thanks for your attention, regards
Viki
推荐答案
嗨....
这将有助于你
Hi....
this will help u
或者,更简单,只需检查两个选择元素的selectedIndex是否相同。
尽管如此,我不知道看不出第二个选择的必要性。如果你已经知道每个国家应该是什么,只需使用文本框来显示它,而不是让用户选择一些东西。
尽可能简化验证,并在在这种情况下,它是完全没必要的(除非它应该是一个测试或其他东西)。
Or, even easier, just check that the selectedIndex of both select elements are the same.
Having said that, though, I don''t see the need for the second select. If you already know what the country should be for each person, just use a textbox to display it instead of getting the user to select something.
Make validation as easy as possible, and in this case, it''s completely unnecessary (unless it''s supposed to be a test or something).
谢谢x你的回复,但是这个脚本存在这一行的问题:
调试器
脚本停止了....
thanks x your reply, but this script presents problems with this line:
debugger
the script is stopped....
这篇关于[Javascript]控制组合选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!