第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

我想使用 PHP 和 mysql 禁用 html 日期選擇器(輸入類型=“日期”)的某些未來日期

我想使用 PHP 和 mysql 禁用 html 日期選擇器(輸入類型=“日期”)的某些未來日期

PHP
慕標(biāo)琳琳 2023-07-30 13:11:10
我想input type="date"使用 PHP 和 MySQL 禁用 HTML 日期選擇器 ( ) 的某些未來日期。有人可以幫我做到這一點(diǎn)嗎?我試圖做到這一點(diǎn),并通過 Google 搜索,但沒有找到使用 PHP 和 MySQL 禁用某些日期的方法。
查看完整描述

1 回答

?
牛魔王的故事

TA貢獻(xiàn)1830條經(jīng)驗(yàn) 獲得超3個(gè)贊

這是一個(gè)演示。這使用 Bootstrap datepicker 和 jquery。另外,我在代碼內(nèi)的注釋中提到了在哪里使用 php


<!DOCTYPE html>

<html>

<head>

    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.css">

    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.css">

    <script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.js"></script>

    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>

</head>

<body>

   

<div class="container">

    <input type="text" name="date" class="form-control datepicker" autocomplete="off">

</div>

   

</body>

  

<script type="text/javascript">

    // This can come from php

    // var disableDates = [<?php //echo $your_variables_from_php_mysql_printed_in_the_format_below; ?>]

    var disableDates = ["7-7-2020", "14-7-2020", "15-7-2020","27-7-2020"];

      

    $('.datepicker').datepicker({

        format: 'mm/dd/yyyy',

        beforeShowDay: function(date){

            dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();

            if(disableDates.indexOf(dmy) != -1){

                return false;

            }

            else{

                return true;

            }

        }

    });

</script>

</html>


查看完整回答
反對(duì) 回復(fù) 2023-07-30
  • 1 回答
  • 0 關(guān)注
  • 141 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)