Returns a substring beginning at a specified location and having a specified length.
stringvar.substr(start [, length ])
Required. A string literal or String object from which the substring is extracted.
Required. The starting position of the desired substring. The index of the first character in the string is zero.
Optional. The number of characters to include in the returned substring.
If length is zero or negative, an empty string is returned. If not specified, the substring continues to the end of stringvar.
The following example illustrates the use of the substr method.
var s = "The quick brown fox jumps over the lazy dog.";
// Get substring.
var ss = s.substr(10, 5);
// Returns "brown".
Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards. See Version Information.