Javascript Parse Page

Discussion in 'PHP' started by Kennedy, Feb 20, 2008.

  1. #1
    Is there a way to change every occurrence of a word into another word.

    For example, you have the Javascript code at the top of the page that changes the word "brown" to "red". The sentence in the page is:

    The quick brown fox.

    But with the Javascript code, it displays like this:

    The quick red fox.

    I know there is a way to do this with Java (its basically how contextual link ad services like Kontera work), I just don't know how do it.
     
    Kennedy, Feb 20, 2008 IP
  2. bquast

    bquast Active Member

    Messages:
    275
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #2
    bquast, Feb 20, 2008 IP
  3. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #3
    You could use str_replace in PHP aswell. Javascript can work with strings, but I am not 100% sure wether JS posses the ability to search through a whole page.
     
    HuggyStudios, Feb 21, 2008 IP