JavaScript tutorial:
bold method

 

Applies to: String Object

The bold method places HTML <b> tags around text in a String object.

Syntax

strVariable.bold( )
"String Literal".bold( )

Return value

None

Example

The following example demonstrates how the bold method works:

<html>
<head>
<script language="JavaScript" >
function boldText()
{
var strVariable = "This text is bold";
strVariable = strVariable.bold( );
return strVariable;
}
</script>
</head>
<body>
 <script language= "javascript"> 
   document.write(boldText());
 </script>
 </body>
 </html>

To run the code, paste it into JavaScript Editor, save as htm file format and click the Show Internal View button.

See also: italics method, String Object methods, String Object Properties