源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

JavaScript toUpperCase()方法使用详解

  • 时间:2022-04-21 12:19 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:JavaScript toUpperCase()方法使用详解
toUpperCase() 方法用于把字符串转换为大写。  一个新的字符串,在其中 stringObject 的所有小写字符全部被转换为了大写字符。 语法为:stringObject.toUpperCase() [b]实例  [/b] 在本例中,"Hello world!" 将以大写字母来显示: 
<script type="text/javascript">
var str="Hello World!"
document.write(str.toUpperCase())

</script>

效果如下:  [img]http://files.jb51.net/file_images/article/201608/201682690517263.jpg?20167269529[/img] 相关方法举例如下: 
<html>
<body>

<script type="text/javascript">

var txt="Hello World!"

document.write("<p>Big: " + txt.big() + "</p>")
document.write("<p>Small: " + txt.small() + "</p>")

document.write("<p>Bold: " + txt.bold() + "</p>")
document.write("<p>Italic: " + txt.italics() + "</p>")

document.write("<p>Blink: " + txt.blink() + " (does not work in IE)</p>")
document.write("<p>Fixed: " + txt.fixed() + "</p>")
document.write("<p>Strike: " + txt.strike() + "</p>")

document.write("<p>Fontcolor: " + txt.fontcolor("Red") + "</p>")
document.write("<p>Fontsize: " + txt.fontsize(16) + "</p>")

document.write("<p>Lowercase: " + txt.toLowerCase() + "</p>")
document.write("<p>Uppercase: " + txt.toUpperCase() + "</p>")

document.write("<p>Subscript: " + txt.sub() + "</p>")
document.write("<p>Superscript: " + txt.sup() + "</p>")

document.write("<p>Link: " + txt.link([url=http://www.1sucai.cn]http://www.1sucai.cn[/url]) + "</p>")
</script>

</body>
</html> 

效果如下: [img]http://files.jb51.net/file_images/article/201608/201682690538385.jpg?20167269545[/img] 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程素材网。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部