Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ช่วยดูโค้ด google map หน่อยครับ รันออกมาหน้าจอเป็นสีขาวครับ รับค่ามาจากเพทอื่นครับ ใช้ค่าละติจูดลองจิจูด ในการปักหมุด



 

ช่วยดูโค้ด google map หน่อยครับ รันออกมาหน้าจอเป็นสีขาวครับ รับค่ามาจากเพทอื่นครับ ใช้ค่าละติจูดลองจิจูด ในการปักหมุด

 



Topic : 061774



โพสกระทู้ ( 345 )
บทความ ( 0 )



สถานะออฟไลน์




Code (PHP)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Map</title>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<style>
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>
</head>
<body>
<div id="map"></div>

<script type="text/javascript"> 
var locations = [ 
<?php
$id_prd=$_GET['id_prd'];
$sql="select * from tb_product where id_prd='$id_prd' ";
	$result=mysql_db_query($db_Name,$sql);
while ($rs=mysql_fetch_array($result)) {
		$id_prd=$rs[id_prd];
		$code=sprintf("%05d",$id_prd);
		$lat_prd=$rs[lat_prd];
		$lng_prd=$rs[lng_prd];}
?>
[ <?=$id_prd?>,  <?=$lat_prd?>,  <?=$lng_prd?>]
]; 

var map = new google.maps.Map(document.getElementById('map'), { 
zoom: 14, 
center: new google.maps.LatLng(14.85467, 103.48357),
mapTypeId: google.maps.MapTypeId.ROADMAP 
}); 
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 
}); 

google.maps.event.addListener(marker, 'click', (function(marker, i) { 
return function() { 
infowindow.setContent(locations[i][0]); 
infowindow.open(map, marker); 
} 
})
(marker, i)); 
} 
</script>
</body>
</html>




Tag : PHP, MySQL









ประวัติการแก้ไข
2011-06-16 22:50:19
2011-06-16 22:52:30
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-06-16 21:52:42 By : buraratn View : 2105 Reply : 7
 

 

No. 1

Guest


ผมว่า ไปปักหมุดบน google Map แล้ว Copy link ของ มันมาใส่จะงาสยกว่ามะครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-17 15:48:11 By : บลู
 


 

No. 2



โพสกระทู้ ( 345 )
บทความ ( 0 )



สถานะออฟไลน์


ตอลแบบตรงๆเลยนะครับ ไม่รู้ทำไงครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-17 18:56:44 By : buraratn
 

 

No. 3



โพสกระทู้ ( 345 )
บทความ ( 0 )



สถานะออฟไลน์


เศร้าไม่มีคนตอบ จ๊าก
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-17 23:36:56 By : buraratn
 


 

No. 4



โพสกระทู้ ( 5,146 )
บทความ ( 26 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


คันดึงมาอันเดียว .. บ่ต้อง ลง while loop ดอกครับผม แค่เปลี่ยนจาก

while ($rs=mysql_fetch_array($result)) {

เปลี่ยนเป็น
$rs=mysql_fetch_array($result);
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-18 00:06:35 By : deawx
 


 

No. 5



โพสกระทู้ ( 5,146 )
บทความ ( 26 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


อันนี้แก้ไขให้ใหม่ ให้ใช้ Google Earth ได้ด้วย
REF# https://www.thaicreate.com/community/google-map-earth-multiple-marker.html
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
$id_prd=$_GET['id_prd'];
$sql="select * from tb_product where id_prd='$id_prd' ";
$result=mysql_db_query($db_Name,$sql);
$rs=mysql_fetch_array($result);
$id_prd=$rs[id_prd];
$code=sprintf("%05d",$id_prd);
$lat_prd=$rs[lat_prd];
$lng_prd=$rs[lng_prd];
?>
['<?=$id_prd?>', <?=$lat_prd?>, <?=$lng_prd?>, <?=$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>



deawx
[email protected]
ปรึกษา PHP ฟรีจ้า


ประวัติการแก้ไข
2011-06-18 00:13:13
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-18 00:10:33 By : deawx
 


 

No. 6



โพสกระทู้ ( 345 )
บทความ ( 0 )



สถานะออฟไลน์


ได้แล้วครับ ขอบคุณมากเลยครับพี่เดี่ยว

ใจดีมากๆ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-18 02:43:25 By : buraratn
 


 

No. 7



โพสกระทู้ ( 5,146 )
บทความ ( 26 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


บ่เป็นหยังจ้า
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-18 06:49:51 By : deawx
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดูโค้ด google map หน่อยครับ รันออกมาหน้าจอเป็นสีขาวครับ รับค่ามาจากเพทอื่นครับ ใช้ค่าละติจูดลองจิจูด ในการปักหมุด
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่