和java差不多的! javascript的字符串类型也有substring这个函数的!
例如 "abc".substring(...) 去google查一下就有很多这样的例子了

解决方案 »

  1.   

    javascript虽然和JAVA没有什么关系?但微软为了搭JAVA的顺风车,javascript的语法结构和JAVA
    的很象.所以我们学JAVA的学javascript还是比较简单的
      

  2.   

    string.substring(indexA, indexB)
    Returns: String of characters between index values indexA and indexB.The string.substring() method enables your scripts to extract a copy of a
    contiguous range of characters from any string. The parameters to this method are
    the starting and ending index values (first character of the string object is index
    value 0) of the main string from which the excerpt should be taken. An important
    item to note is that the excerpt goes up to, but does not include, the character
    pointed to by the higher index value.
    It makes no difference which index value in the parameters is larger than the
    other: The method starts the excerpt from the lowest value and continues to (but
    does not include) the highest value. If both index values are the same, the method
    returns an empty string; and if you omit the second parameter, the end of the
    string is assumed to be the endpoint.例:
    var aStr = "this is a book";
    var bStr = aStr.substring(0, 4);bStr的值为"this"