JavaScript fixed()方法語法淺析
JavaScript fixed()方法有很多值得學(xué)習(xí)的地方,這里就和大家分享一下它的定義和語法,相信本文介紹一定會讓你有所收獲。
JavaScript fixed()方法
定義和用法
fixed() 方法用于把字符串顯示為打字機字體。
語法
stringObject.fixed()實例
在本例中,"Hello world!" 將被顯示為打字機文本:
- <script type="text/javascript">
- var str="Hello world!"
- document.write(str.fixed())
- </script>
JavaScript fixed函數(shù)語法
string.fixed();
JavaScript fixed函數(shù)返回值
返回使用HTML tt 標(biāo)簽定義的粗體字符串
JavaScript fixed函數(shù)示例
- var str = "www.scjtxx.cn";
- document.write(str.fixed());
結(jié)果:
- www.scjtxx.cn
實現(xiàn)使用HTML tt 標(biāo)簽定義的單間距字符串。
【編輯推薦】
- IE6.0中使用Javascript支持png格式圖片
- 兼容IE6,IE7,IE8,Firefox的CSS HACK寫法
- Javascript代碼輕松判斷IE6瀏覽器
- 完美實現(xiàn)IE6/IE7/FF瀏覽器兼容通用方法
- 揭露JavaScript DOM操作基本原則