Development| HTML| JavaScript| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
JavaScript sup method 
 

In the JavaScript, method sup() method is used to format text in superscript format.

 

JavaScript sup method

                         

In the JavaScript, method sup() method is used to format text in superscript format. It makes a copy of that string and then embed it within <sup></sup> tags as in HTML.

Syntax:

 String_Object.sup();

It returns the copy of string in the superscript format.

Description of code:

Here we have created an input text and button. We have to supply string into the input text to convert them into superscript format. Click on the button to call the function superscriptText() as defined in the JavaScript within the <script></script> tags. It takes the text string into a variable textToSuperscript and there after we have converted the string into superscript format by calling method sup() on the string reference object. Here is the full HTML code as follows :

superscriptExample.html

<html>
<head>
 <title>
   Convert string to superscript
 </title>
 <script language="JavaScript">
 function superscriptText()
 {
  var textToSuperscript = document.getElementById('txt').value;
  document.write("<p> Superscript text "+
           textToSuperscript.sup()+"</p>");
 }
 </script>
</head>
<body>
<div style="background: #ff9900; width:'100%';"
    align="center">
  <font color="#0000ff" size="12pt">
	<b>sup() Example</b>
  </font>
</div>
 <center>
  Insert any text 
 <input type="text" id="txt" /><br>
 <div id="divId" style="backgroud :#ccccff"></div>
 <input type="button" value="Convert text to superscript"
   onClick="return superscriptText();"/>
 </center>
 </body>
</html>

Output:

Insert any text to format them into superscript format and click on the button "Convert text to superscript" 

You can see from the following output that the text inserted "Welcome" is converted to the superscript format.

Download Source Code

                         

» View all related tutorials
Related Tags: java javascript c attributes script reference object method sed remove ip attribute node move nat to ref e it alter

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.