如何在PHP JavaScript中的特殊日子禁用按钮

时间:2019-05-08 07:57:42

标签: codeigniter

例如,我有7个按钮,我将确保在不同日期的特定日期禁用按钮。如何实现呢?

<input type ="submit" class="day1" id="day1">button1

<input type ="submit" class="day2" id="day2">button2

<input type ="submit" class="day3" id="day3">button3

<input type ="submit" class="day4" id="day4">button4

<input type ="submit" class="day5" id="day5">button5

<input type ="submit" class="day6" id="day6">button6

<input type ="submit" class="day7" id="day7">button7

2 个答案:

答案 0 :(得分:0)

您还可以在php或javascript中获取当前日期和日期,并根据您在php或javascript中的要求禁用按钮(添加条件)。

答案 1 :(得分:0)

尝试下面的代码,我希望它能起作用。

// Numeric representation of the day of the week,  0=sunday,1=monday
$dayOfWeek = date('w',time());


<input type ="submit" class="day1" id="day1" <?php echo $dayOfWeek==0?'disabled':''?>>button1