Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
HTML DOM Underline Object
The HTML DOM Underline Object in HTML represents the <u> element.
Creating a <u> element
var uObject = document.createElement(“U”)
Let us see an example of Underline element −
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML DOM Underline</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>HTML-DOM-Underline</legend>
<h2 ><u id="Underline">Warning: </u>This is a Demo Example</h2>
<input type="button" value="Show" onclick="getBetterDisp()">
</fieldset>
</form>
<script>
var uObject = document.getElementById("Underline");
function getBetterDisp() {
uObject.style.backgroundColor = '#DC3545';
uObject.style.color = '#FFF';
}
</script>
</body>
</html>
Output
Before clicking show button −

After clicking show button −

Advertisements
