The Superscript object represents an HTML <sup> element.
We can access a <sup> element via document.getElementById()
:
var x = document.getElementById("mySup");
Click the button to set the color of <sup> element to red.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {/*from w w w . java 2s .c o m*/ var x = document.getElementById("mySup"); x.style.color = "red"; } </script> </body> </html>