-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. 隱藏選擇2選項
- 4. jQuery無法根據選擇選項顯示/隱藏元素
- 5. 根據選擇的選項顯示/隱藏div
- 6. 根據其他選擇值隱藏選項
- 7. 根據選擇的選項顯示/隱藏不同的表單
- 8. 根據javascript中的選擇選項顯示/隱藏div
- 9. 根據以前的選擇隱藏選項
- 10. 根據選擇框顯示/隱藏div
- 11. 根據選擇框的值隱藏div
- 12. 根據asp:RadioButton選擇顯示/隱藏Div
- 13. 根據以前的選項自動選擇HTML隱藏選項值
- 14. 隱藏收藏夾選擇選項
- 15. 當選擇特定選項值時顯示隱藏文本框
- 16. 當選項卡使用DataTemplate時從代碼隱藏選擇TabItem
- 17. 當選擇選項時javascript顯示隱藏的div
- 18. SharePoint 2010:隱藏多項選擇選項
- 19. Jquery:當選擇特定的選擇選項時隱藏html元素
- 20. 根據選擇下拉選擇隱藏/顯示div
- 21. 根據選中的複選框選擇相關的隱藏值
- 22. 當做選擇時隱藏DIV
- 23. jquery時間選擇器隱藏在表
- 24. 隱藏行當選擇複選框
- 25. 顯示和隱藏選擇選項
- 26. 隱藏選擇選項跨瀏覽器
- 27. HTML表單選擇選項不隱藏
- 28. 選擇選項和隱藏div jquery
- 29. jquery,隱藏/顯示選擇選項
- 30. 選擇選項隱藏和顯示
你得至少嘗試寫一些代碼。簡單的答案當然是,是的。但是先嚐試一下。 – Difster
你可以給他們每個相同的類,把它們全部放在同一個數組中,然後用它來執行一些操作。但那超出了這個問題的範圍。簡短的回答是是 – Chris
寫一些代碼來幫助。 –