Javascript Knowledge

  • what is javascript

  • javascript Variable
  • javascript function
  • javascript Event

  • JavaScript If
  • javascript for

  • javascript object
  • Javascript String
  • Javascript Date
  • Javacsript Array
  • Javascript Math

  • Javascript onclick
  • JavaScript onload

  • Javascript Frame
  • Javascript Image
  • Javascript Style
  • Javascript Textarea
  • Javascript Table
  • Javascript window
  • Javascript Location
  • Javacsript form
  • Javascript Checkbox
  • Javascript Input
  • Javascript Radio
  • Javascript Select
  • Javascript Submit

  • Javascript alert
  • Javascript close
  • Javascript confirm
  • Javascript Document open
  • Javascript getElementById
  • Javascript print
  • Javascript reload
  • Javascript remove
  • JavaScript replace
  • Javascript setTimeout
  • JavaScript split
  • JavaScript substring
  • Javascript window open
  • window showmodaldialog

  • Javascript href
  • Javascript IFrame
  • Javascript innerHTML
  • Javascript selectedindex
  • Javascript URL
  • Javascript window Location

  • javascript write to file
  • JavaScript write
  • javascript string to integer
  • Javascript popup
  • Javascript return
  • Javascript Obfuscator
  • Javascript disable
  • Javascript Hide
  • More others

    Javascript
    CSS
    PHP

     

    Javascript substring


    JavaScript substring() Method
    Javascript substring ( ) Definition and Usage

    The Javascript substring() method extracts the characters in a string between two specified indices.

    Javascript substring ( ) Syntax
    stringObject.substring(start,stop)

     

    Parameter

    Description

    start

    Required. Where to start the extraction. Must be a numeric value

    stop

    Optional. Where to stop the extraction. Must be a numeric value

    Javascript substring ( ) Tips and Notes

    Note: To extract characters from the end of the string, use a negative start number.

    Note: The start index starts at 0.

    Note: If the stop parameter is omitted, this method extracts to the end of the string.

    Javascript substring ( ) Example

    In this example we will use substring() to extract some characters from a string:

    <script type="text/javascript">

    var str="Hello world!" document.write(str.substring(3))

    </script>

    The output of the code above will be:

    lo world!

    Javascript substring ( ) Example

    In this example we will use substring() to extract some characters from a string:

    <script type="text/javascript"> var str="Hello world!" document.write(str.substring(3,7)) </script>

    The output of the code above will be:

    lo w

     





















     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  • Javascript |