为字符串添加样式

  1. <html>
  2. <body>
  3.  
  4. <script type="text/javascript">
  5.  
  6. var txt="Hello World!"
  7.  
  8. document.write("<p>Big: " + txt.big() + "</p>")
  9. document.write("<p>Small: " + txt.small() + "</p>")
  10.  
  11. document.write("<p>Bold: " + txt.bold() + "</p>")
  12. document.write("<p>Italic: " + txt.italics() + "</p>")
  13.  
  14. document.write("<p>Blink: " + txt.blink() + " (does not work in IE)</p>")
  15. document.write("<p>Fixed: " + txt.fixed() + "</p>")
  16. document.write("<p>Strike: " + txt.strike() + "</p>")
  17.  
  18. document.write("<p>Fontcolor: " + txt.fontcolor("Red") + "</p>")
  19. document.write("<p>Fontsize: " + txt.fontsize(16) + "</p>")
  20.  
  21. document.write("<p>Lowercase: " + txt.toLowerCase() + "</p>")
  22. document.write("<p>Uppercase: " + txt.toUpperCase() + "</p>")
  23.  
  24. document.write("<p>Subscript: " + txt.sub() + "</p>")
  25. document.write("<p>Superscript: " + txt.sup() + "</p>")
  26.  
  27. document.write("<p>Link: " + txt.link("http://www.baidu.com") + "</p>")
  28. </script>
  29.  
  30. </body>
  31. </html>