Naver, Daum, Google Open API
글 수 52
cyber
http://www.subkorea.com/api/google/MapsAPI/trafficOverlay.htm 지도에 교통량 표시, 토글시 표시 사라짐
<!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" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example: Traffic Overlays</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=abc...xyz"
type="text/javascript"></script>
<script type="text/javascript">
var map;
var trafficInfo = new GTrafficOverlay();
var toggleState = 1;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(40.652513,-73.936615), 12);
map.addControl(new GSmallMapControl());
map.addOverlay(trafficInfo);
}
}
function toggleTraffic() {
if (toggleState == 1) {
map.removeOverlay(trafficInfo);
toggleState = 0;
} else {
map.addOverlay(trafficInfo);
toggleState = 1;
}
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width: 640px; height: 480px; float:left; border: 1px solid black;"></div>
<br clear="all"/>
<br/>
<input type="button" value="Toggle Traffic" onClick="toggleTraffic();"/>
<br/>
</body>
</html>
http://subkorea.com/xe/84665
(*.225.54.140)
|