|
|
|
ช่วยด้วยครับ อัพ google map ขึ้น host แล้วครีใช้ไม่ได้ทำยังไงครั จะสอบพรุ่งนี้แล้วครับ ขอความช่วยผมด่วนครับ |
|
|
|
|
|
|
|
Code (PHP)
<html><head>
<title>ระบบค้นหาหอพัก</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/style.css">
<style type="text/css">
body {margin-right:0px;margin-left: 0px;margin-top:0px;margin-bottom:0px;}
#map_canvas {
width:200px;
height:200px;
margin:auto;
margin-top:100px;
}
</style>
<script language="javascript" src="js/jquery-1.5.1.min.js"></script>
<script type="text/javascript">
$(function(){
function drag_me(name){
$(name).css({
position:"absolute",
cursor:"move"
});
$(name).mousedown(function(event){
var locateX=event.pageX;
var locateY=event.pageY;
var obj_locateX=$(this).offset().left;
var obj_locateY=$(this).offset().top;
var diff_x=locateX-obj_locateX;
var diff_y=locateY-obj_locateY;
$(this).css("opacity",0.3).mousemove(function(event){
locateX=event.pageX;
locateY=event.pageY;
obj_locateX=$(this).offset().left;
obj_locateY=$(this).offset().top;
new_locateX=locateX-diff_x;;
new_locateY=locateY-diff_y;
$(this).css({
left:new_locateX,
top:new_locateY
}).bind("mouseup mouseout",function(){
$(this).css("opacity",1);
$(this).unbind("mousemove");
});
});
});
}
// การใช้งาน กำหนด selector วัตถุที่ต้องการ
// ในตัวอย่างคือ div ที่มี id เท่ากับ myblock
drag_me("div#myblock");
});
</script>
<style type="text/css">
<!--
.text1 { color: #666;
font-size: x-small;
font-family: Arial, Helvetica, sans-serif;
font-weight: normal;
}
-->
</style>
<script type="text/javascript" src="http://bc46.com/syntaxhighlighter/scripts//shCore.js"></script>
<script type="text/javascript" src="http://bc46.com/syntaxhighlighter/scripts//shBrushAll.js"></script>
<link type="text/css" rel="stylesheet" href="http://bc46.com/syntaxhighlighter/styles/shCore.css"/>
<link type="text/css" rel="stylesheet" href="http://bc46.com/syntaxhighlighter/styles/shThemeDefault.css"/>
<script type="text/javascript">
SyntaxHighlighter.config.clipboardSwf = 'http://bc46.com/syntaxhighlighter/scripts//clipboard.swf';
SyntaxHighlighter.all();
</script>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAgrj58PbXr2YriiRDqbnL1RSqrCjdkglBijPNIIYrqkVvD1R4QxRl47Yh2D_0C1l5KXQJGrbkSDvXFA"
type="text/javascript"></script>
<script type="text/javascript">
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
var center = new GLatLng(14.85467, 103.48357);
map.setCenter(center, 15);
geocoder = new GClientGeocoder();
var marker = new GMarker(center, {draggable: true});
map.addOverlay(marker);
document.getElementById("lat").innerHTML = center.lat().toFixed(5);
document.getElementById("lng").innerHTML = center.lng().toFixed(5);
GEvent.addListener(marker, "dragend", function() {
var point = marker.getPoint();
map.panTo(point);
document.getElementById("lat").innerHTML = point.lat().toFixed(5);
document.getElementById("lng").innerHTML = point.lng().toFixed(5);
});
GEvent.addListener(map, "moveend", function() {
map.clearOverlays();
var center = map.getCenter();
var marker = new GMarker(center, {draggable: true});
map.addOverlay(marker);
document.getElementById("lat").innerHTML = center.lat().toFixed(5);
document.getElementById("lng").innerHTML = center.lng().toFixed(5);
GEvent.addListener(marker, "dragend", function() {
var point =marker.getPoint();
map.panTo(point);
document.getElementById("lat").innerHTML = point.lat().toFixed(5);
document.getElementById("lng").innerHTML = point.lng().toFixed(5);
});
});
}
}
function showAddress(address) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
document.getElementById("lat").innerHTML = point.lat().toFixed(5);
document.getElementById("lng").innerHTML = point.lng().toFixed(5);
map.clearOverlays()
map.setCenter(point, 14);
var marker = new GMarker(point, {draggable: true});
map.addOverlay(marker);
GEvent.addListener(marker, "dragend", function() {
var pt = marker.getPoint();
map.panTo(pt);
document.getElementById("lat").innerHTML = pt.lat().toFixed(5);
document.getElementById("lng").innerHTML = pt.lng().toFixed(5);
});
GEvent.addListener(map, "moveend", function() {
map.clearOverlays();
var center = map.getCenter();
var marker = new GMarker(center, {draggable: true});
map.addOverlay(marker);
document.getElementById("lat").innerHTML = center.lat().toFixed(5);
document.getElementById("lng").innerHTML = center.lng().toFixed(5);
GEvent.addListener(marker, "dragend", function() {
var pt = marker.getPoint();
map.panTo(pt);
document.getElementById("lat").innerHTML = pt.lat().toFixed(5);
document.getElementById("lng").innerHTML = pt.lng().toFixed(5);
});
});
}
}
);
}
}
</script>
</head>
<body onLoad="load()" onUnload="GUnload()" >
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
<tbody><tr>
<td align="center" valign="top"><table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF"><? include 'logo.php'; ?> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><? include 'menu.php'; ?></td>
</tr>
</table>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" bgcolor="#FFFFFF"><div align="center"><span class="head_doc">
<br>
</span></div>
<p> </p>
<p align="center"><strong>ลาก<img src="img/point.gif" width="20" height="34"> ไปยังจุดที่หอพักท่านอยู่ </strong>
<center><table width="300" align="center" bgcolor="#FFFFCC">
<tr>
<td><b>Latitude</b></td>
<td><b>Longitude</b></td>
</tr>
<tr>
<td id="lat"></td>
<td id="lng"></td>
</tr>
</table><div align="center" id="map" style="width: 650px; height: 400px"><br/></div></p>
<p> </p>
<p> </p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><? include 'foorter.php'; ?></td>
</tr>
</table> <p> </p></td>
</tr>
</table></td>
</tr>
</tbody></table>
</div>
</body></html>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2011-12-15 19:09:00 |
By :
buraratn |
View :
1019 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลิ้งที่ใช้ครับ ดูตามนี้เลยก็ได้ครับ http://www.surinjoggingclub.com/dormitory/view_lati.php
|
|
|
|
|
Date :
2011-12-15 19:10:36 |
By :
buraratn |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้ละครับขอบคุณครับ ลบ sensor=true_or_false& ออก ถามเองตอบเอง อิอิ
|
|
|
|
|
Date :
2011-12-15 19:19:42 |
By :
buraratn |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|