1 <HTML> 2 3 <HEAD> 4 <TITLE>JavaScript Example: Text attributes</TITLE> 5 </HEAD> 6 7 <BODY BGCOLOR="#FFFFFF"> 8 9 <SCRIPT LANGUAGE="JavaScript"> 10 <!-- hide script from old browsers 11 12 document.writeln("<H2>Text attributes</H2>"); 13 document.writeln("This text is bold.".bold() + "<BR>"); 14 document.writeln("This text is italicized.".italics() + "<BR>"); 15 document.writeln("This is strike-through text.".strike() + "<BR>"); 16 var myStr = "This text is set in a fixed-width font."; 17 document.writeln(myStr.fixed() + "<BR>"); 18 document.writeln("This is red text.".fontcolor("red") + "<BR>"); 19 myStr = "This text has been converted to "; 20 document.writeln(myStr + "LOWERCASE.".toLowerCase() + "<BR>"); 21 document.writeln(myStr + "uppercase.".toUpperCase() + "<BR>"); 22 23 document.writeln("<H2>Subscripts and superscripts</H2>"); 24 document.writeln("1 + x" + "1".sub() + 25 " + x" + "2".sub() + 26 " + x" + "3".sub() + "<BR>"); 27 document.writeln( "x" + "3".sup() + 28 " + x" + "2".sup() + " + x + 1<BR>"); 29 30 // end script hiding --> 31 </SCRIPT> 32 33 </BODY> 34 35 </HTML>