iLTC Home
Bookmark iLTC!
iLTC Google Boards

Google Groups
Receive The Code in Email!



Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • Pass the Javascript, please...
    20,076

    iLoveTheCode.com
    Javascript > Javascript Tutorials How To Easy > Substitute in Javascript Using replace Method

    Substitute in Javascript Using replace Method



    To substitute in Javascript, use the replace() method:

    hu = "LENDEN";

    hu = hu.replace(/e/ig, "o");

    Which Prints:
    LoNDoN

    -We created a variable and named it hu because we felt like it.
    -We said to replace the any letter "e"s you find with "o"s. The i means case-INsensitive. The g means change ALL "e"s, not just the first one.



    Free Copy and Paste Javascript Code:

    <script type="text/javascript">
    <!--

    hu = "LENDEN";

    hu = hu.replace(/e/ig, "o");

    document.write(hu);

    -->
    </script>


    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Formatting Time in Javascript
    Next Article: Call your Function in Javascript





    Creating Web SitesCreating Web Sites

    Matthew MacDonald

    New $19.77

    Struts 2 in ActionStruts 2 in Action

    Don Brown, Chad Da...

    New $29.69

    Pro CSS and HTML Design ...Pro CSS and HTML Design Patterns

    Michael Bowers

    New $29.69

    DojoDojo

    Matthew A. Russell...

    New $26.39

    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39

    Head First HTML with CSS...Head First HTML with CSS & XHTML

    Eric Freeman, Elis...

    New $26.39

    JavaScriptJavaScript

    David Flanagan

    New $31.49

    CSSCSS

    David McFarland

    New $23.09


    Of Interest:
  • Exit a Loop with Last
  • If, Elsif, and Else in Perl
  • Encryption with the Crypt Function in Perl
  • Getting Server Time in Perl
  • Setting a Cookie using Javascript
  • Get Formatted Time in Javascript
  • Annoy Users with onBlur in Javascript
  • Javascript Unshift - Use Unshift to Put Items on the Front of an Array in Javascript
  • HTML Title Tag
  • HTML Link
  • Make Text Bold Using HTML
  • HTML Tags

  • More Articles:
  • Getting What is Matched in Perl
  • Matching with a Regular Expression, REGEX, in Perl
  • Finding the Length (Index Numbers) of an Array in Perl
  • Create or Put Items into an Array in Perl
  • onClick Javascript
  • Write a For Loop in Javascript
  • PRINT to Browser with document.write Command in Javascript
  • Get String Length with Javascript
  • HTML Title Tag
  • Make a Line Return Using HTML
  • HTML Space
  • Make Italic Text Using HTML

  • Search iLTC w/ Google





    Recent Articles

  • Javascript Focus Form Field
  • Javascript Lowercase Text
  • Javascript Uppercase Text
  • Javascript Superscript Text
  • Javascript Subscript Text
  • Make Text Blink Using Javascript
  • Make a String into a Link in Javascript
  • Javascript Italics Text
  • Javascript Bold Text
  • Javascript Redirect
  • HTML Frames
  • HTML Color Chart
  • HTML Link
  • Javascript Status Bar








  • Perl Programming - Javascript Programming - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006 iLoveTheCode.com


    Contact Chris | About this Site


    316,816
    Counter by iLoveTheCode.com


    Last Modified: Friday, 23-Jun-2006 07:23:17 EDT