这篇文章主要介绍了JavaScript中fixed()方法的使用,是JS入门学习中的基础知识,需要的朋友可以参考下
此方法会导致就好像它是在一个的标签被显示在固定间距的字体的字符串。
语法
?
1 string.fixed( )下面是参数的详细信息:
NA
返回值:
返回字符串的标签
例子:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 <html> <head> <title>JavaScript String fixed() Method</title> </head> <body> <script type="text/javascript"> var str = new String("Hello world"); alert(str.fixed()); </script> </body> </html>这将产生以下结果:
?
1 <tt>Hello world</tt>