Javascript DOM HTML Input Week stepDown() Method

Introduction

Decrement the value of a week field by 10 weeks:

document.getElementById("myWeek").stepDown(10);

Click the button to decrement the value of the week field by 10 weeks.

input elements with type="week" are not supported in Firefox.

View in separate window

<!DOCTYPE html>
<html>
<body>
<input type="week" id="myWeek" value="2014-W15">
<button onclick="myFunction()">Test</button>
<script>
function myFunction() {//from w w  w .j  av a2  s .c  om
  document.getElementById("myWeek").stepDown(10);
}
</script>

</body>
</html>

The stepDown() method decrements the value of the week field by a specified number.

This method will only have an affect on WEEKS.

To increment the value, use the stepUp() method.

In Safari, you must enter a week in the week field before you can decrement the value.

stepDown(number);

Parameter Values

Parameter
Description
number


Required.
Sets the amount of weeks the week field should decrease.
If omitted, the weeks are decremented by "1"



PreviousNext

Related