JavaScript tutorial:
sub method

 

Applies to: String Object

The sub method places HTML <SUB> tags around text in a String object.

Syntax

strVariable.sub( )
"String Literal".sub( )

Return value

None

Example

The following example demonstrates how the sub method works:

<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function subTag()
{
var strVariable = "This is a string object"
strVariable = strVariable.sub( );
return strVariable ;
}
</SCRIPT></HEAD>
<BODY>
<P> See how it work in Html
<SCRIPT LANGUAGE="JavaScript"> document.write(subTag());</SCRIPT></P>
</BODY>

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

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