-3
A
回答
0
这对我的作品=)
var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
if(h==10){
if(m<=30){
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
}
else{
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
}
}
else if(h==11){
if(m<=30){
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
}
else{
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
}
}
else if(h==12){
if(m<=30){
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
}
else{
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(7)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("disabled",'disabled');
}
}
else if(h==13){
if(m<=30){
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(8)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(7)').attr("disabled",'disabled');
}
else{
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(9)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(7)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(8)').attr("disabled",'disabled');
}
}
else if(h==14){
if(m<=30){
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(10)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(7)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(8)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(9)').attr("disabled",'disabled');
}
else{
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(11)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(7)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(8)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(9)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(10)').attr("disabled",'disabled');
}
}
else if(h>=15){
jQuery('#order_wcj_checkout_field_3 option:nth-child(10)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3').append("<option value='00'>Hoje acabou. Compre com agendamento amanhã.</option>");
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(11)').attr("selected",'selected');
}
相关问题
- 1. 隐藏当前选择的选项
- 2. 根据选择的选项显示/隐藏不同的表单
- 3. 根据其他选择值隐藏选项
- 4. jQuery无法根据选择选项显示/隐藏元素
- 5. 根据以前的选择隐藏选项
- 6. 根据以前的选项自动选择HTML隐藏选项值
- 7. Jquery:当选择特定的选择选项时隐藏html元素
- 8. 根据选择下拉选择隐藏/显示div
- 9. 当做选择时隐藏DIV
- 10. 隐藏行当选择复选框
- 11. jquery时间选择器隐藏在表
- 12. 显示和隐藏选择选项
- 13. 隐藏语言选择选项Drupal 8
- 14. jquery,隐藏/显示选择选项
- 15. 选择选项和隐藏div jquery
- 16. HTML表单选择选项不隐藏
- 17. 查询:根据当天日期和显示器之间选择
- 18. 如何根据其他选择的选择框选项来隐藏/显示选择框?
- 19. JQuery根据天隐藏div
- 20. 根据单选按钮选择隐藏确定按钮
- 21. 根据复选框选择显示/隐藏对象
- 22. 如何根据单选按钮选择显示和隐藏div
- 23. 根据单选按钮选择设置隐藏的输入值
- 24. 当用户选择一个选项,导航或选择相同的选项时,如何隐藏元素?
- 25. 当选择其他选择下拉选项时,jQuery显示/隐藏选项下拉菜单
- 26. JS隐藏按钮,当变化选择选项
- 27. jquery函数根据选择哪个选项来显示/隐藏textareas
- 28. 根据选择的选项显示或隐藏不同的divs,格式为
- 29. jquery选择选项应根据选项编号选择
- 30. 如何根据另一选择选项禁用选择选项
你得至少尝试写一些代码。简单的答案当然是,是的。但是先尝试一下。 – Difster
你可以给他们每个相同的类,把它们全部放在同一个数组中,然后用它来执行一些操作。但那超出了这个问题的范围。简短的回答是是 – Chris
写一些代码来帮助。 –