Javascript-string-fixed

提供:Dev Guides
移動先:案内検索

JavaScript文字列-fixed()メソッド

説明

このメソッドにより、文字列は<tt>タグ内にあるかのように固定ピッチフォントで表示されます。

構文

その構文は次のとおりです-

string.fixed( )

戻り値

*<tt>* タグ付きの文字列を返します。

次の例を試してください。

<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>