Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: replace()

  1. #1
    Regular Coder
    Join Date
    Jan 2004
    Location
    Port Huron, MI, U.S.A.
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question replace()

    How do you use string.replace()? The concept seems simple enough, but I don't understand the $$4\'t\7 type stuff used in the arguements. Is it supposed to be a string? What does it represent and/or do?
    Oh, was I supposed to put something here? ........

  • #2
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well to replace I think you can do something like this -

    Code:
    document.body.innerHTML=document.body.innerHTML.replace("1st String","2nd String");

  • #3
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    those funky things is a regular expression, it is easy to understand once you know what it means.

    JavaScript Kit has a tutorial on them:
    http://javascriptkit.com/javatutors/re.shtml

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #4
    Regular Coder
    Join Date
    Jan 2004
    Location
    Port Huron, MI, U.S.A.
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks!
    Oh, was I supposed to put something here? ........


  •  

    Posting Permissions

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