HTML DOM 下劃線物件
HTML DOM 下劃線物件在 HTML 中表示 <u> 元素。
建立一個 <u> 元素
var uObject = document.createElement(“U”)
讓我們看看一個 下劃線 元素示例 -
示例
<!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>輸出
點選 顯示 按鈕前 -

點選 顯示 按鈕後 -

廣告
資料結構
網路
關係型資料庫管理系統 (RDBMS)
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP