Specific Text Color Change Help!

Discussion in 'JavaScript' started by yagga, Jun 11, 2010.

  1. #1
    Hello,

    i need a code that changes a specific text like: "bye" to the color green.
    so anytime i use the word BYE in my script, that it appears in the color green without using anytime the code: "font-color"!

    Thanks!
     
    yagga, Jun 11, 2010 IP
  2. sanjayarora19

    sanjayarora19 Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use style sheets..
    make a class in style-sheet and define , text-bye and color-green..
     
    sanjayarora19, Jun 11, 2010 IP
  3. yagga

    yagga Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hi thanks for the reply.
    because im new with scripting, i still dont know exactly how to do it..
     
    yagga, Jun 11, 2010 IP
  4. rainborick

    rainborick Well-Known Member

    Messages:
    424
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    120
    #4
    If you mean you want to simply add some JavaScript to an existing HTML page and have it scan the content for specific words or phrases and then change the color of the text, I would recommend using a server-side tool like Perl or PHP instead. While it would be possible to do this with JavaScript, it would be cumbersome to write the code, probably very slow, and a bit startling to users when they see the changes flow through the page. Perl and PHP both have better ways of scanning HTML and since the processing is done before the HTML is sent to the user's browser, there's no visible changes to the page after it loads. Good luck!
     
    rainborick, Jun 11, 2010 IP