javascript Onchange
我有两个下拉列表,一个用于接送位置,另一个用于下车位置。两者的选项都是
泽西机场
泽西港
泽西岛酒店
根西岛机场
根西岛港
根西岛酒店
当我选择在根西岛接载时,当他们去下车时,泽西岛不会 出现...
function test(val){
alert(val);
if(val == 'Jersey Airport' || val == 'Jersey Harbour' || val == 'Jersey Hotel'){
//
}else if(val == 'Guernsey Airport' || val == 'Guernsey Harbour' || val == 'Guernsey Hotel'){
//
}else{
}
}
如何使用 JavaScript 来做到这一点?
I've two dropdown lists one for pick up location and other for drop off location. Options in both are
Jersey Airport
Jersey Harbour
Jersey Hotel
Guernsey Airport
Guernsey Harbour
Guernsey Hotel
When I select the pick up in Guernsey, when they went to the drop off, Jersey would not
appear...
function test(val){
alert(val);
if(val == 'Jersey Airport' || val == 'Jersey Harbour' || val == 'Jersey Hotel'){
//
}else if(val == 'Guernsey Airport' || val == 'Guernsey Harbour' || val == 'Guernsey Hotel'){
//
}else{
}
}
How to do it using JavaScript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里没有太多信息可以继续,很高兴看到您的选择 html。
然而我注意到的一件事是你的 if 和 else if 是相同的,你的意图是否是做类似的事情:
希望这有帮助
There is not a lot of information to go on here, would have been nice to see you html for the selects.
However one thing i noticed is your if and else if are identical, were your intentions to do something like:
Hope this helps