Javascript-string-bold

提供:Dev Guides
2020年6月23日 (火) 09:40時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

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

説明

このメソッドにより、文字列が <b> タグ内にあるかのように太字で表示されます。

構文

bold()メソッドの構文は次のとおりです-

string.bold( )

戻り値

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

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

<html>
   <head>
      <title>JavaScript String bold() Method</title>
   </head>

   <body>
      <script type = "text/javascript">
         var str = new String("Hello world");
         alert(str.bold());
      </script>
   </body>
</html>

出力

<b>Hello world</b>