Javascript Subscript Text
j="TM";
j=j.sub();
document.write("This is a good time." + j);
Which Prints:
This is a good time.
TM
-We created a variable and named it
j because the letter j is a fine letter.
-We applied Javascript's built-in
sub method to our
j string.
-We stored those results back into
j.
-We used Javascript's built-in
document.write to print to the browser.
We could have also written this a little differently, like so:
j="TM";
document.write("This is a good time." + j.sub());
ADVANCED: You can also apply more than one method to the string:
j="TM";
j=j.italics().sub().link('http://google.com');
document.write("This is a good time." + j);
or
j="TM";
document.write("This is a good time." + j.italics().sub().link('http://google.com'));
Free Copy and Paste Javascript Code:
<script type="text/javascript">
<!--
i="TM";
j=i.sub();
document.write(i);
document.write(j);
document.write("This is a good time." + i.sub());
-->
</script>
Resources:
Make Text Bold Using Javascript
Italic Text in Javascript
Redirect in Javascript
Status Bar in Javascript
Change Fonts in Javascript
Sun Javascript Documentation on Strings
HTML Tags
HTML Color Chart
HTML Codes