HTMLDOMTableDataヘッダープロパティ
HTML DOM TableData headersプロパティは、HTMLドキュメント内のテーブルのheaders属性の値を返し、変更します。
構文
以下は構文です-
1。ヘッダーを返す
object.headers
2。 colspanの追加
object.headers = “headers_ids”
ヘッダープロパティの例を見てみましょう-
例
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
background: lightblue;
height: 100vh;
text-align: center;
}
table {
margin: 2rem auto;
width: 400px;
}
.btn {
background: #db133a;
border: none;
height: 2rem;
border-radius: 2px;
width: 40%;
display: block;
color: #fff;
outline: none;
cursor: pointer;
margin: 1rem auto;
}
.show {
font-size: 1.2rem;
}
</style>
<body>
<h1>DOM TableData headers Property Demo</h1>
<table border="2">
<thead>
<tr>
<th>Name</th>
<th>Roll No.</th>
</tr>
<thead>
<tbody>
<tr>
<td headers="Name">John</td>
<td headers="Rollno">071717</td>
</tr>
<tr>
<td headers="Name: Jane" id="jane-data">Jane</td>
<td headers="Rollno">031717</td>
</tr>
</tbody>
</table>
<button onclick="get()" class="btn">Show Headers Value</button>
<div class="show"></div>
<script>
function get() {
document.querySelector(".show").innerHTML = document.querySelector('#jane-data').headers;
}
</script>
</body>
</html> 出力
これにより、次の出力が生成されます。
「ヘッダー値を表示」をクリックします 」ボタンをクリックして、ジェーンのヘッダー属性の値を表示します 行。
-
HTMLDOMOlタイププロパティ
HTML DOM Ol typeプロパティは、順序付きリストで使用されるマーカーのタイプに対応するtype属性の値を設定/返します。 以下は構文です- タイププロパティを返す olObject.type 設定タイプ キャラクターに olObject.type = ‘1|a|A|i|I’ Olタイプの例を見てみましょう プロパティ- 例 <!DOCTYPE html> <html> <head> <title>HTML DOM Ol type</title> <style> &n
-
HTML DOMOlstartプロパティ
HTML DOM Ol startプロパティは、順序付きリストのstart属性の値を設定/返します。 以下は構文です- 数値を返す olObject.start 開始の設定 番号に olObject.start = number Ol startの例を見てみましょう プロパティ- 例 <!DOCTYPE html> <html> <head> <title>HTML DOM Ol start</title> <style> form { widt