クリックイベントを設定する

説明

クリックイベントを設定するにはevent()を使います。最初のパラメータに"leftdown"、2番目のパラメータにイベント発生時に呼び出す関数名を文字列で指定します。戻り値には緯度や経度、Shift/Controlキーの押下情報が返されます。

サンプルプログラム

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<title>電子国土(国土地理院)</title>
<script type="text/javascript"><!--
function app_main(){
top.map.openMap("http://cyberjapan.jp/japan0.htm");
top.map.setMapCenter(137.95340448617935, 36.114983812119554, 20000);
top.map.openMap();
top.map.setMouseMode("pan");
top.map.event("leftdown", "message");
}
function message(lat,lng){
document.getElementById("msg").innerHTML = "クリックイベントが発生しました。"+lat+","+lng;
}
// --></script>
</head>
<body>
<h1>クリックイベントを設定する</h1>
<div id="msg"></div>
<iframe name="map" src="./map.html" width="640" height="480"></iframe>
</body>
</html>
サンプルを実行
[戻る]