Input Week valueProperties

Input Week 对象参考手册Input Week Object

Examples

Set the year and week of the week field:

document.getElementById("myWeek").value = "2014-W48";

Try it yourself »

Definition and Usage

The value property sets or returns the value of the value attribute of the week field.

The value property describes the value entered by the user, the default value, or the value entered by a script.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value property.

Note:Internet Explorer or Firefox browsers do not support the <input type="week"> element.


Syntax

Return the value property:

weekObject.value

Set the value property:

weekObject.value=YYYY-WWW

Property Values

Value Description
YYYY-WWW Describes the week and year. Parsed as follows:
  • YYYY - year (e.g., 2011)
  • "-W" means "week"
  • WW - week (between 1 and 52 or 53 (depending on the year), e.g., 01 for the first week of the year)
Example: 2014-W15

Technical Details

Return Value: A string representing the year and week of the week field.


More Examples

Example

Get the year and week of the week field

var x = document.getElementById("myWeek").value;
xThe output result is:
1995-W35

Try it yourself »


Related Pages

HTML Reference Manual:HTML <input> value Attribute


Input Week 对象参考手册Input Week Object Other Extensions