Area hostプロパティ
Area オブジェクト
定義と用法
host プロパティは href 属性値を設定または返しますホスト名:ポート部分。
構文
areaObject.host=hostname:port
ブラウザサポート
![]()
![]()
![]()
![]()
![]()
すべての主要ブラウザが host プロパティをサポートしています
ヒントと注記
注意:URL のポート部分が指定されていない場合、またはポートが80(デフォルト値)の場合、一部のブラウザではポート部分が表示されません。
例
例
次の例は "Venus" エリアのホスト名とポートを返します。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.com)</title>
</head>
<body>
<img src="planets.gif.html" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm.html">
</map>
<p>金星エリアの hostname:port:
<script>
document.write(document.getElementById('venus').host);
</script>
</p>
<p><b>注意:</b>URL のポート部分が指定されていない場合、または80(デフォルト)の場合、一部のブラウザではポート部分が表示されません。</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.com)</title>
</head>
<body>
<img src="planets.gif.html" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm.html">
</map>
<p>金星エリアの hostname:port:
<script>
document.write(document.getElementById('venus').host);
</script>
</p>
<p><b>注意:</b>URL のポート部分が指定されていない場合、または80(デフォルト)の場合、一部のブラウザではポート部分が表示されません。</p>
</body>
</html>
上記の例の出力結果:
金星エリアの hostname:port: www.example.com
試してみる »
Area オブジェクト その他の拡張