Javascript DOM HTML Input Week stepUp() Method

Introduction

Increment the value of a week field by 10 weeks:

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

Click the button to increment 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 ww  .j  a  v  a2s .c  o m
  document.getElementById("myWeek").stepUp(10);
}
</script>

</body>
</html>

The stepUp() method increments the value of the week field by a specified number.

This method will only have an affect on WEEKS.

To decrement the value, use the stepDown() method.

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

stepUp(number);

Parameter Values

Parameter
Description
number


Required.
Set the amount of weeks the week field should increase.
If omitted, the weeks are incremented by "1"

The stepUp() method has No return value.




PreviousNext

Related