Results 1 to 3 of 3

Thread: replace a character

  1. #1
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question replace a character

    Howdy

    how do I replace the a with a b in the image name and assign it to j ?

    if i = "../../images/01a.jpg"

    Thanks in advance

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Code:
    var original = "../../images/01a.jpg", j;
    var replaceValue = "b";
    if(original.indexOf("a.") !== -1){
    	var j = original.split("a.")[0] + replaceValue + "." + original.split("a.")[1];
    }
    alert(j)

  3. The Following User Says Thank You to codeexploiter For This Useful Post:

    cocag (12-14-2009)

  4. #3
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Smile

    Thanks bud ;o))

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •