All Objects
String Object
METHOD: String::(various formatting methods)
object.
'formatting_method'( )
There are various methods available that allow you to perform formatting alterations to the contents of your
String
object when written to a document. These methods are:
big
,
blink
,
bold
,
fixed
,
fontcolor
,
fontsize
,
italics
,
small
,
strike
,
sub
and
sup
.
The following code writes the contents of the "myString"
String
object to the document with a different formatting method applied each time it is written.
Code:
myString = new String("Formatting methods")
document.write ("<p>big() = " + myString.big())
document.write ("<br>blink() = " + myString.blink())
document.write ("<br>bold() = " + myString.bold())
document.write ("<br>fixed() = " + myString.fixed())
document.write ("<br>fontcolor("red") = " + myString.fontcolor("red"))
document.write ("<br>fontsize("5") = " + myString.fontsize("5"))
document.write ("<br>small() = " + myString.small())
document.write ("<br>strike() = " + myString.strike())
document.write ("<br>sub() = " + myString.sub())
document.write ("<br>sup() = " + myString.sup())
Output:
big() =
Formatting methods
blink() =
Formatting methods
bold() =
Formatting methods
fixed() = Formatting methods
fontcolor("red")=
Formatting methods
fontsize("5") =
Formatting methods
small() =
Formatting methods
strike() =
Formatting methods
sub() =
Formatting methods
sup() =
Formatting methods
NOTE: blink() may not work on some browsers
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information