文字の修飾

 JavaScript上からでも文字の修飾指定を行うことが出来ます。document.writeでの文字列中にタグを書く事もできますが、JavaScriptでの修飾指定は一時的なもので後々の文字列には影響を与えません。

◆実行結果


◆スクリプト

var str = "This is a test string<BR>"
document.write("通常:",str)
document.write("big():",str.big())
document.write("blink():",str.blink())
document.write("bold():",str.bold())
document.write("fixed():",str.fixed())
document.write("fontcolor(color):",str.fontcolor('red'))
document.write("fontsize(size):",str.fontsize(7))
document.write("italics():",str.italics())
document.write("small():",str.small())
document.write("strike():",str.strike())
document.write("sub():",str.sub())
document.write("sup():",str.sup())
document.write("toLowerCase():",str.toLowerCase())
document.write("toUpperCase():",str.toUpperCase())