Google Maps traffic layer


<style type=”text/css”>
html { height: 100%;}
body { height: 100%; margin: 0px; padding: 0px; }
#map { height: 600px; width: 600px; }
</style>

/* script call here

http://maps.google.com/maps/api/js?sensor=false&#8221; type=”text/javascript”

*/
/*script start here*/
google.maps.event.addDomListener( window, ‘load’, init );

function init() {
var options = {
zoom: 7,
center: new google.maps.LatLng( 32.715738, -117.161084 ),
mapTypeId: google.maps.MapTypeId.ROADMAP,
overviewMapControl: false
};
var map = new google.maps.Map( document.getElementById( “map” ), options );
var traffic = new google.maps.TrafficLayer();
traffic.setMap( map );

google.maps.event.addDomListener(
document.getElementById( ‘b’ ),
‘click’,
function() {
traffic.setMap( traffic.getMap() === null ? map : null )
} );
}
/*script end here*/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s