微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

JavaScript toUpperCase()方法使用详解

toupperCase() 方法用于把字符串转换为大写。

一个新的字符串,在其中 stringObject 的所有小写字符全部被转换为了大写字符。

语法为:toupperCase()

实例

在本例中,"Hello World!" 将以大写字母来显示

rush:js;">

效果如下:

相关方法举例如下:

rush:xhtml;">

<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) + "

")

效果如下:

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程之家。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐