Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Project </title>
- <style type='text/css'>
- #peta {
- width: 85%;
- height: 500px;
- }
- </style>
- <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
- <script type="text/javascript">
- (function() {
- window.onload = function() {
- var map;
- var locations = [
- <?php
- mysql_connect('localhost','root','');
- mysql_select_db('lokasi');
- $sql_lokasi="SELECT nama,lat,lon, owner FROM lokasi1 ";
- $result=mysql_query($sql_lokasi1);
- $dt=array();
- while($data=mysql_fetch_object($result)){
- $dt[]="['{$data->nama}',{$data->lat}, {$data->lon},'{$data->owner}']";
- }
- echo implode(",",$dt);
- ?>
- ];
- var options = {
- zoom: 9,
- center: new google.maps.LatLng(-7.248397400000001000, 107.909651599999960000),
- mapTypeId: google.maps.MapTypeId.ROADMAP
- };
- var map = new google.maps.Map(document.getElementById('peta'), options);
- var infowindow = new google.maps.InfoWindow();
- var marker, i;
- for (i = 0; i < locations.length; i++) {
- marker = new google.maps.Marker({
- position: new google.maps.LatLng(locations[i][1], locations[i][2]),
- map: map,
- icon: (locations[i][3]=='DMT'?'tb.png':(locations[i][3]=='Protelindo'?'tp.png':'tt.png'))
- });
- google.maps.event.addListener(marker, 'click', (function(marker, i) {
- return function() {
- infowindow.setContent(locations[i][0]);
- infowindow.open(map, marker);
- }
- })(marker, i));
- }
- };
- })();
- </script>
- </head>
- <body>
- <div id="peta"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment