|
 |
|
ช่วยแก้ไขโค้ดกันหน่อยค่ะ รันแล้วมันขึ้แต่จอขาวๆ เกี่ยวกับการปักหมุดแผนที่ |
|
 |
|
|
 |
 |
|
พอดีได้โค้ด ปักหมุด google map มาแล้วลองประยุคดูค่ะ ไม่มันรันออกเป็นจอขาว
ช่วยแก้ไขให้หน่อยค่ะCode (PHP)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Google Map</title>
<style type="text/css">
html {
height: auto;
}
body {
height: auto;
margin: 0;
padding: 0;
}
#map {
height: auto;
position: absolute;
bottom:0;
left:0;
right:0;
top:0;
}
@media print {
#map {
height: 950px;
}
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript"
src="https://www.google.com/jsapi?key=ABQIAAAA_KNcKfoyaTskjEp-kSSEjxSsDbTxMRg-JrUcPZT14QWonZA5mxRqx3ct_DbeHVelXNr1WbKEEJ5k-A"></script>
<script src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/googleearth/src/googleearth-compiled.js" type="text/javascript"></script>
<script type="text/javascript">
google.load('earth', '1');
var map;
var googleEarth;
function init() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: new google.maps.LatLng(15.720278, 100.443889),
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
googleEarth = new GoogleEarth(map);
var locations = [
<?php
$sql="select * from place";
$result=mysql_db_query($db_Name,$sql);
$rs=mysql_fetch_array($result);
$id_place=$rs[id_place];
$code=sprintf("%05d",$id_place);
$lati_place=$rs[lati_place];
$long_place=$rs[long_place];
?>
['<?=$id_place?>', <?=$lati_place?>, <?=$long_place?>, <?=$id?>]
];
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]),
draggable : false,
title : locations[i][0],
icon : 'http://maps.google.com/mapfiles/kml/pal3/icon48.png',
map: map
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})
(marker, i));
}
}
google.maps.event.addDomListener(window, 'load', init);
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
Tag : PHP, MySQL, JavaScript

|
ประวัติการแก้ไข 2011-08-11 14:16:50
|
 |
 |
 |
 |
Date :
2011-08-11 12:53:05 |
By :
fasaiaya |
View :
1225 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วยดูให้หน่อยค่ะ พี่ๆ
|
 |
 |
 |
 |
Date :
2011-08-11 15:54:36 |
By :
fasaiaya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองถาม อ. ทวีชัย ดูนะ
|
 |
 |
 |
 |
Date :
2011-08-11 18:56:03 |
By :
benz_16 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันต้องเซฟเป็น php หรือ html
|
 |
 |
 |
 |
Date :
2011-08-11 20:08:29 |
By :
fasaiaya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แก้แบบนี้ก็ยังไม่ออกค่ะ
Code (PHP)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Google Map Test by Deawx</title>
<style type="text/css">
html {
height: auto;
}
body {
height: auto;
margin: 0;
padding: 0;
}
#map {
height: auto;
position: absolute;
bottom:0;
left:0;
right:0;
top:0;
}
@media print {
#map {
height: 950px;
}
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript"
src="https://www.google.com/jsapi?key=ABQIAAAA_KNcKfoyaTskjEp-kSSEjxSsDbTxMRg-JrUcPZT14QWonZA5mxRqx3ct_DbeHVelXNr1WbKEEJ5k-A"></script>
<script src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/googleearth/src/googleearth-compiled.js" type="text/javascript"></script>
<script type="text/javascript">
google.load('earth', '1');
var map;
var googleEarth;
function init() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: new google.maps.LatLng(15.105355046221582, 104.31570053100586),
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
googleEarth = new GoogleEarth(map);
var locations = [
<?php
include("connectdb.php");
$sql="select * from place";
$result=mysql_db_query($sql);
$rs=mysql_fetch_array($result);
$id_place=$rs[id_place];
$code=sprintf("%05d",$id_place);
$lat_place=$rs[lat_place];
$lng_place=$rs[lng_place];
?>
['<?=$id_place?>', <?=$lat_place?>, <?=$lng_place?>, <?=$id?>]
];
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]),
draggable : false,
title : locations[i][0],
icon : 'http://maps.google.com/mapfiles/kml/pal3/icon48.png',
map: map
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})
(marker, i));
}
}
google.maps.event.addDomListener(window, 'load', init);
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
|
 |
 |
 |
 |
Date :
2011-08-11 21:38:35 |
By :
fasaiaya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|