Input Date max属性用于设置或返回日期字段的max属性的值。 max属性返回一个字符串,该字符串表示允许的最大日期。
用法:
要返回max属性:inputdateObject.max
设置max属性:inputdateObject.max = YYYY-MM-DD
属性值:
YYYY-MM-DDThh:mm:ssTZD:它用于指定允许的最大日期和时间。YYYY:指定年份。
MM:指定月份。
DD:指定月份中的某天。
T:如果还输入时间,则指定分隔符。
hh:指定小时。
mm:指定分钟。
ss:指定秒数。
TZD:指定时区指示符。
以下示例程序旨在说明Date max属性:
获取日期字段允许的最大日期。
Input Date max Property in HTMLh1 {
color:green;
}
h2 {
font-family:Impact;
}
body {
text-align:center;
}
GeeksforGeeks
Input Date max Property
The range of date accepted is between 2019-02-18 and 2019-02-20:
to return the max range of the date field,
double click the "Return Max" button.
Return Max
function My_Date() {
var d = document.getElementById("Test_Date").max;
document.getElementById("test").innerHTML = d;
}
输出:
单击按钮后
支持的Web浏览器:
苹果Safari
IE浏览器
Firefox
谷歌浏览器
Opera