Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q821 How can I change the color of text that I write to the document?

irt.org | Knowledge Base | JavaScript | Document | Q821 [ previous next ]

Q821 How can I change the color of text that I write to the document?

Use:

<SCRIPT LANGUAGE="JavaScript"><!--
document.write('<FONT COLOR="black">');
document.write('<P><B>Question.</B> What is black and white and');
document.write('</FONT>');
document.write('<FONT COLOR="red">');
document.write(' red ');
document.write('</FONT>');
document.write('<FONT COLOR="black">');
document.write('all over?');
document.write('</FONT>');
document.write('<FONT COLOR="black">');
document.write('<P><B>Answer.</B> ');
document.write('</FONT>');
document.write('<FONT COLOR="green">');
document.write('A newspaper.');
document.write('</FONT>');
//--></SCRIPT>

Also take a look at the article How long is a piece of string? - Style and Presentation.


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.