JavaScript toUpperCase()方法使用詳解
更新時間:2016年08月26日 09:01:05 作者:水墨墨心
這篇文章主要為大家詳細介紹了JavaScript toUpperCase()方法的使用技巧,感興趣的小伙伴們可以參考一下
toUpperCase() 方法用于把字符串轉(zhuǎn)換為大寫。
一個新的字符串,在其中 stringObject 的所有小寫字符全部被轉(zhuǎn)換為了大寫字符。
語法為:stringObject.toUpperCase()
實例
在本例中,"Hello world!" 將以大寫字母來顯示:
<script type="text/javascript"> var str="Hello World!" document.write(str.toUpperCase()) </script>
效果如下:

相關方法舉例如下:
<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(http://www.fzitv.net) + "</p>")
</script>
</body>
</html>
效果如下:

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
微信小程序 Animation實現(xiàn)圖片旋轉(zhuǎn)動畫示例
這篇文章主要介紹了微信小程序 Animation實現(xiàn)圖片旋轉(zhuǎn)動畫示例,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-08-08
Jquery實現(xiàn)的tab效果可以指定默認顯示第幾頁
tab效果想必大家在網(wǎng)上都有見過很多吧,在本文將為大家介紹下如何實現(xiàn)可以在代碼里面指定默認顯示第幾頁的tab效果,感興趣的朋友不要錯過2013-10-10
javascript中將Object轉(zhuǎn)換為String函數(shù)代碼 (json str)
下面的代碼就是想將Object轉(zhuǎn)換為String函數(shù),需要的朋友可以參考下2012-04-04

