HTML DOMTableHeaderabbrプロパティ
HTML DOM TableHeader abbrプロパティは、HTMLドキュメント内のテーブルのabbr属性の値を返し、変更します。
構文
以下は構文です-
1。略語を返す
object.abbr
2。略語の追加
object.abbr = “text”
abbrプロパティの例を見てみましょう:
例
<!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;
}
</style>
<body>
<h1>DOM TableHeader abbr Property Demo</h1>
<table border="2">
<thead>
<tr>
<th>Name</th>
<th>Language</th>
</tr>
<thead>
<tbody>
<tr>
<td id="john">John</td>
<td abbr="Eng" id="john-lang">English</td>
</tr>
<tr>
<td id="elon">Elon</td>
<td abbr="Ger" id="elon-lang">Germany</td>
</tr>
</tbody>
</table>
<button onclick="get()" class="btn">Show abbr Value</button>
<div class="show"></div>
<script>
function get() {
document.querySelector(".show").innerHTML = "abbr for English: " + document.querySelector("#john-lang").abbr;
}
</script>
</body>
</html> 出力
「略語の値を表示」をクリックします 」ボタンをクリックして、abbr属性の値を表示します。
-
HTMLDOMoffsetWidthプロパティ
HTML DOM offsetWidthプロパティは、パディング、境界線、スクロールバーを含む要素の幅に対応する数値を返しますが、マージンは返しません。 以下は構文です- 数値を返す HTMLelement.offsetWidth HTML DOM offsetWidthの例を見てみましょう プロパティ- 例 <!DOCTYPE html> <html> <head> <title>HTML DOM offsetHeight</title> <style> form { &n
-
HTMLDOMoffsetParentプロパティ
HTML DOM offsetParentプロパティは、子オフセットが定義されている参照された親要素を返します。 以下は構文です- 参照されたオフセット親要素を返す HTMLelement.offsetParent HTML DOM offsetParentの例を見てみましょう。 プロパティ- 例 <!DOCTYPE html> <html> <head> <title>HTML DOM offsetParent</title> <style type="text/css"> &n