此方法使字符串以固定间距字体显示,就好像它在<tt>标签中一样。
fixed() - 语法
string.fixed( )
fixed() - 返回值
返回带有<tt>标签的字符串。
fixed() - 示例
<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>
运行上面代码输出
<tt>Hello world</tt>