|
|
|
รัน jquery google api ไม่ขึ้นค่ะ รบกวนช่วยดูให้หน่อยค่ะ |
|
|
|
|
|
|
|
รัน google api ไม่ขึ้นเลย ค่ะ
รบกวนผู้รู้ดูให้หน่อยค่ะว่าผิดตรงไหน
Code
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=key_api">
</script>
<script type="text/javascript">
var map;
var marker;
var latitudeTextBox = $("#LatitudeTextBox");
var longitudeTextBox = $("#LongitudeTextBox");
jQuery(document).ready(function () {
var centerLatlng = new google.maps.LatLng(33.976222, -118.281698);
var mapOptions = {
zoom: 10,
center: centerLatlng,
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DEFAULT
},
navigationControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.DEFAULT
}
};
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
// Edit existing location so that we need to display
// Display default marker
marker = new google.maps.Marker({
draggable: true,
map: map,
position: centerLatlng
});
// After dragging, updates both Lat and Lng.
google.maps.event.addListener(marker, 'dragend', function () {
var curLatLng = marker.getPosition();
latitudeTextBox.val(curLatLng.lat());
longitudeTextBox.val(curLatLng.lng());
});
google.maps.event.trigger(marker, "click");
});
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
Tag : PHP, MySQL, JavaScript, jQuery, Web (ASP.NET)
|
|
|
|
|
|
Date :
2014-10-12 21:46:40 |
By :
K927 |
View :
1004 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src="https://maps.googleapis.com/maps/api/js?key=key_api"
ต้องมี key ก่อนนะ เข้าไปดูที่นี่นะ Google Maps API Key
|
|
|
|
|
Date :
2014-10-12 22:23:18 |
By :
Krungsri |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<!DOCTYPE html>
<html>
<head>
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false">
</script>
<script>
function initialize()
{
var latitudeTextBox = document.getElementById("latitude");
var longitudeTextBox = document.getElementById("longitude");
var mapOption = {
zoom: 10,
center: new google.maps.LatLng(latitudeTextBox.value,longitudeTextBox.value),
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DEFAULT
},
navigationControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.DEFAULT
}
};
var map = new google.maps.Map(document.getElementById("googleMap"),mapOption);
marker = new google.maps.Marker({
draggable: true,
map: map,
position: new google.maps.LatLng(latitudeTextBox.value,longitudeTextBox.value),
});
google.maps.event.addListener(marker, 'dragend', function () {
var curLatLng = marker.getPosition();
latitudeTextBox.value = curLatLng.lat();
longitudeTextBox.value = curLatLng.lng();
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="googleMap" style="width:500px;height:380px;"></div>
<label for="latitude">Lat: <input type="text" id="latitude" value="16.420306952381196"></label>
<label for="longitude">Lang: <input type="text" id="longitude" value="101.15419700000007"></label>
</body>
</html>
|
|
|
|
|
Date :
2014-10-12 22:57:38 |
By :
Krungsri |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วค่ะ
ขอบคุณกั๊บปม
|
|
|
|
|
Date :
2014-10-12 23:06:00 |
By :
K927 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|