DIGIT-ARC read-only archive · snapshot: July 23, 2026

xhtml help

10 posts · originally from https://geek.digit.in/community/threads/xhtml-help.142549/

speedyguy
speedyguy Original post #1
Jun 18, 2011 at 5:19 PM
i need to write an xhtml code with a paragraph where i need to assign colors based on their words. for example, all prepositions with color red. how do i do that?

now what i know is, i can use css to assign colors, or use javascript to pass events. but how do i put up an if for a particular text (word)

Enjoy~!
nims11
nims11 #2
Jun 18, 2011 at 5:45 PM
you need to use javascript to achieve that.
abhidev
abhidev #3
Jun 18, 2011 at 8:09 PM
js all the way.......
speedyguy
Jun 19, 2011 at 2:15 PM
Ya but can u guide me with that. Im not able to figure out how to validate text words...

Enjoy~!
abhidev
abhidev #5
Jun 20, 2011 at 12:30 PM
can you mention the different criteria based on which you want to highlight the words??
speedyguy
Jun 21, 2011 at 1:26 PM
take for simple example... an html paragraph <p> with all prepositions (like a,the,this,that,it etc) be colored red.

Enjoy~!
Garbage
Garbage #7
Jun 21, 2011 at 1:34 PM
I think you need this - JavaScript Text Highlighting
arpanmukherjee1
Jun 23, 2011 at 9:44 AM
^^ that was a good find. i included the source in my bank
speedyguy
Jun 23, 2011 at 11:50 AM
seriously very good find.... thanks a lot... :)

Enjoy~!
abhidev
abhidev #10
Jun 23, 2011 at 1:22 PM
cool....got u got ur answer....

nice find @garbage