clearListeners

書式

GEvent.clearListeners(listener, eventName)

説明

指定されたマップの指定したイベントの全てを削除します。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAasAJryKxWJnBFVJa487d9hTHGAxTVT7IRADYa-JdYz7xQ8IQZBSthgDZdggYpQHsmm6WYtHstQFfLA" type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 500px; height: 400px"></div>
<script type="text/javascript">
//<![CDATA[
var map = new GMap(document.getElementById("map"));
map.centerAndZoom(new GPoint(140, 25), 15);
map.addControl(new GLargeMapControl());
GEvent.addListener(map, "click", function(overlayObj, mapPoint){
alert(mapPoint);
} );
GEvent.addListener(map, "zoom", function(){ alert("Zoom!"); });
function clrEvent() {
GEvent.clearListeners(map, "zoom");
}
//]]>
</script>
<form>
<input type="button" value="zoomイベントを削除" onClick="clrEvent()">
</form>
</body>
</html>