Javascript examples for DOM HTML Element:Superscript
You can create a <sup> element by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">create a SUP element with some text</button> <script> function myFunction() {//from w w w. ja v a2s.c om var x = document.createElement("SUP"); var t = document.createTextNode("This text contains superscript text"); x.appendChild(t); document.body.appendChild(x); } </script> </body> </html>