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