The max
property sets or gets the value of the max attribute of a week field.
The max
attribute sets the maximum week and year for a week field.
max |
Yes | No | No | Yes | Yes |
Return the max property.
weekObject.max
Set the max property.
weekObject.max=YYYY-WWW
Value | Description |
---|---|
YYYY-WWW | Specifies the maximum week and year allowed.
|
A String type value representing the maximum week and year allowed.
The following code shows how to change the maximum week and year allowed.
<!DOCTYPE html>
<html>
<body>
<input type="week" id="myWeek" min="2014-W12" max="2014-W19">
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!--from ww w . ja v a2s . co m-->
var x = document.getElementById("myWeek").max = "2014-W35";
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to get the maximum week and year allowed for a week field.
<!DOCTYPE html>
<html>
<body>
<!--from w ww . j a va 2 s . c om-->
Enter a week between Week 12 and Week 19 in 2014:
<input type="week" id="myWeek" min="2014-W12" max="2014-W19">
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myWeek").max;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: