首页 > 代码库 > google地图API的简单使用
google地图API的简单使用
<div id="contact_container" style="width:700px;height:600px;"></div>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(39.95745,116.32764);
var myOptions = {
zoom: 18,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("contact_container"), myOptions);
var marker = new google.maps.Marker({
position: map.getCenter(),
map: map,
title: ‘CAAS‘
});
}
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = http://www.mamicode.com/"http://maps.google.com/maps/api/js?language=en&sensor=false&callback=initialize";
document.body.appendChild(script);
}
window.onload = loadScript;
</script>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(39.95745,116.32764);
var myOptions = {
zoom: 18,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("contact_container"), myOptions);
var marker = new google.maps.Marker({
position: map.getCenter(),
map: map,
title: ‘CAAS‘
});
}
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = http://www.mamicode.com/"http://maps.google.com/maps/api/js?language=en&sensor=false&callback=initialize";
document.body.appendChild(script);
}
window.onload = loadScript;
</script>
google地图API的简单使用
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。