Area hrefプロパティ
Area オブジェクト
定義と用法
href プロパティは、ある領域のhref属性の値を設定または返します。
href プロパティは、ある領域のターゲットリンクを指定します。
構文
areaObject.href=URL
ブラウザサポート
![]()
![]()
![]()
![]()
![]()
すべての主要ブラウザが href プロパティをサポートしています。
例
例
次の例は、画像マップ内の「Venus」領域のhrefプロパティを返します:
<!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>金星のhrefプロパティ値:
<script>
document.write(document.getElementById("venus").href);
</script>
</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>金星のhrefプロパティ値:
<script>
document.write(document.getElementById("venus").href);
</script>
</p>
</body>
</html>
上記の例の出力結果:
金星のhrefプロパティ値: http://www.example.com/try/demo_source/venus.htm
試してみる »
Area オブジェクト その他の拡張