toUpperCase() 方法用于把字符串转换为大写。
一个新的字符串,在其中 stringObject 的所有小写字符全部被转换为了大写字符。
语法为:实例
在本例中,"Hello world!" 将以大写字母来显示:
效果如下:
相关方法举例如下:
<script type="text/javascript">
var txt="Hello World!"
document.write("
Big: " + txt.big() + "
")document.write("
Small: " + txt.small() + "
")document.write("
Bold: " + txt.bold() + "
")document.write("
Italic: " + txt.italics() + "
")document.write("
Blink: " + txt.blink() + " (does not work in IE)
")document.write("
Fixed: " + txt.fixed() + "
")document.write("
Strike: " + txt.strike() + "
")document.write("
Fontcolor: " + txt.fontcolor("Red") + "
")document.write("
Fontsize: " + txt.fontsize(16) + "
")document.write("
Lowercase: " + txt.toLowerCase() + "
")document.write("
Uppercase: " + txt.toUpperCase() + "
")document.write("
Subscript: " + txt.sub() + "
")document.write("
Superscript: " + txt.sup() + "
")document.write("
Link: " + txt.link(<a href="//www.jb51.cc">//www.jb51.cc) + "
")