HTMLDOMテーブルのtFootプロパティ
HTML DOMテーブルのtFootプロパティは、HTMLドキュメント内のテーブルの
要素を返します。構文
以下は構文です-
object.tFoot
HTMLDOMテーブルのtFootプロパティの例を見てみましょう-
例
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
background: lightblue;
height: 100vh;
text-align: center;
}
table {
margin: 2rem auto;
}
.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 Table tFoot Property Demo</h1>
<table border="2">
<thead>
<tr>
<th>Name</th>
<th>Roll No.</th>
</tr>
<thead>
<tbody>
<tr>
<td>John</td>
<td>071717</td>
</tr>
<tr>
<td>Jane</td>
<td>031717</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">Table Footer</td>
</tr>
</tfoot>
</table>
<button onclick="get()" class="btn">Show tFoot</button>
<div class="show"></div>
<script>
function get() {
var tableFooter = document.querySelector('table').tFoot;
document.querySelector(".show").innerHTML = tableFooter.innerHTML;
}
</script>
</body>
</html> 出力
「tFootを表示」をクリックします 」ボタンをクリックして、テーブルのフッターを表示します。
-
HTMLDOM名プロパティ
HTML DOM nameプロパティは、要素の属性の名前に対応する文字列を返します。 以下は構文です- 文字列値を返す elementAttribute.name HTMLDOM名の例を見てみましょう プロパティ- <!DOCTYPE html> <html> <head> <title>HTML DOM name</title> <style> * { padding: 2px; margin:5px; &
-
HTMLDOMtextContentプロパティ
HTML DOM textContentプロパティは、ノードとそのすべての子ノードのテキスト(空白を含む)に対応する文字列を返す/設定します。 以下は構文です- 文字列値を返す Node.textContent ここで、戻り値は次のようになります- ドキュメントノードの「Null」 指定されたノードとそのすべての子ノードのテキスト textContentを文字列値に設定します Node.textContent = string 注:HTML DOM textContent プロパティは、ノードと子ノードのテキストを単一のテキスト文字列として設定します。 HTML DOM