Home > areaオブジェクト > protocolプロパティ
protocolプロパティ
areaオブジェクトのprotocolプロパティはイメージマップ・リンクのプロトコルを返します。ページのリンク情報は配列で格納されているのでIndex番号を指定してプロパティの値を取得します。
書式 | document.links[index番号].protocol |
対応 | |
値 | イメージマップ・リンクのプロトコル |
使用例 | イメージマップ・リンクのプロトコルを表示する。 |
<html>
<head>
<title>JavaScript area protocol</title>
<script type="text/javascript">
function dispProtocol(){
for(var i=0 ; i < document.links.length ; i++){
alert('プロトコル:' + document.links[i].protocol);
}
}
</script>
</head>
<body>
<map name="area_test">
<area shape="rect" coords="16,17,96,93"
href="http://www.google.co.jp/index.html" alt="Googleへ">
<area shape="circle" coords="147,55,40"
href="http://www.yahoo.co.jp/index.html" alt="Yahooへ">
<area shape="poly" coords="53,111,16,182,96,182"
href="http://msn.co.jp/windows/index.html" alt="MSNへ">
<area shape="poly" coords="147,104,106,150,147,190,192,150"
href="http://www.excite.co.jp/" alt="Exciteへ">
</map>
<img src="imgarea.jpg" usemap="#area_test"
border=0 width="200px" height="200px">
<form name="fm">
イメージマップ・リンクのプロトコルを表示する
<input type="button" value="確認" onclick="dispProtocol()">
</form>
</body>
</html>