Javascript examples for DOM HTML Element:Underline
You can create a <u> element by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">create a U element with some text</button> <script> function myFunction() {/*w w w .j ava 2s.c om*/ var x = document.createElement("U"); var t = document.createTextNode("This text is underlined"); x.appendChild(t); document.body.appendChild(x); } </script> </body> </html>