HTMLDOMリンクサイズプロパティ
HTML DOMリンクサイズプロパティは、リンク要素のサイズ属性の値を返します。
注 − sizeプロパティは、relプロパティが「icon」に設定されている場合にのみ使用されます
構文
以下は構文です-
サイズを返す 属性値
linkObject.sizes
例
Link relの例を見てみましょう プロパティ-
<!DOCTYPE html>
<html>
<head>
<title>Link sizes</title>
<link id="extStyle" rel="icon" href="new.gif" sizes="10x10">
</head>
<body>
<form>
<fieldset>
<legend>Link-sizes</legend>
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var extStyle = document.getElementById("extStyle");
if(extStyle.sizes == '10x10')
divDisplay.textContent = 'The linked icon size: '+extStyle.sizes+' is not compatible';
else
divDisplay.textContent = 'Congrats! The linked icon size is compatible';
</script>
</body>
</html> 上記の例では、「style.css」 含む-
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
} 出力
これにより、次の出力が生成されます-
-
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