Javascript examples for DOM HTML Element:Subscript
The Subscript object represents an HTML <sub> element.
You can access a <sub> element by using getElementById():
<!DOCTYPE html> <html> <body> <sub id="mySub">this subscript text</sub> <button onclick="myFunction()">set the color</button> <script> function myFunction() {//from www .j ava2s . c o m var x = document.getElementById("mySub"); x.style.color = "red"; } </script> </body> </html>