[Javascript] styling text
Peter Brunone
peter at brunone.com
Fri Nov 30 20:35:42 CST 2007
Have you tried using innerHTML? As in
span.innerHTML = span.innerHTML.replace("dirty", "<span class='blueWord'>dirty</span");
It may not be elegant enough for some, but it seems to do the job.
Cheers,
Peter
----------------------------------------
From: Scott Petersen petersen at ma.medias.ne.jp
I have a problem I can't seem to solve. I want to take this markup:
dirty ?? I have to clean my room. It is dirty. and color the word "dirty" in the sentence blue, or set it off in some other way. I thought to create a span element and style it with CSS. However, I am not able to replace the plain text with the span element. I could mark the word up to begin with, but for work flow I thought I might try to let javascript do the work. Any thoughts? Scott Petersen By the way, the Japanese is merely a gloss of the English.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20071130/a57b883a/attachment.htm>
More information about the Javascript
mailing list