谷歌地图显示钦奈(印度)使用javascript
Google map to show chennai (India) using javascript
在下面的Javascript代码中,我放置了一个谷歌地图,它显示了马里,但我想显示金奈(印度)。我尝试过,但无法解决这个问题。所以请帮我做这件事。
<script
src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false">
</script>
<script>
var myCenter=new google.maps.LatLng(15.508742,-0.500850);
function initialize()
{
var mapProp = {
center: myCenter,
zoom:5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("googleMap"),mapProp);
var marker = new google.maps.Marker({
position: myCenter,
title:'Click to zoom'
});
marker.setMap(map);
// Zoom to 9 when clicking on marker
google.maps.event.addListener(marker,'click',function() {
map.setZoom(9);
map.setCenter(marker.getPosition());
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="googleMap" style="width:500px;height:380px;"></div>
您在这条线上使用的坐标:
var myCenter=new google.maps.LatLng(15.508742,-0.500850);
指向马里,只需将数字更改为印度的坐标即可。
对于金奈,使用:
var myCenter=new google.maps.LatLng(13.052138,80.251608);
相关文章:
- 正在添加'X'按钮,在文本字段旁边使用javascript
- 使用javascript将动态表从一个html页面打印到另一个html页
- 如何使用javascript或html下载PDF格式的填写表单
- 动态地改变“”的URL;添加新项目”;链接使用javascript/jquery
- 如何使用javascript从主svg对象动态创建svg视图框
- 通过单击表单中的按钮,在代码生成中使用javascript生成字母数字代码
- 使用Javascript获取所选选项ID
- 如果文本字段为空,则使用JavaScript应用CSS样式
- 使用javascript从数据库中添加表
- JSON.parse没有'不能使用Javascript
- 使用javascript检查多个输入值,并在1次检查中标记多个输入框
- 可以't使用JavaScript获取width属性
- 如何使用javascript获取嵌套对象中所有子对象的单个属性
- 使用javascript在Flash中加载外部图像
- 使用Javascript创建测验页面
- 在PHP中使用javascript更改页面标题'if'
- 使用javascript函数在页面初始化后加载jquery
- 无法使用javascript检索SPList项
- 使用javascript存储变量的最安全方式
- 使用javascript搜索具有用户输入的数组