How to create google map in html | CodeTextPro - CodeTextPro | Free Web Tutorial

Codetextpro Provides free Web tutorial, HTML, CSS, C, C++, Java, JavaScript, PHP, MySql, Python, Program, Programming Notes, Programming Questions and more.

Programming

Saturday, January 12, 2019

How to create google map in html | CodeTextPro




In this tutorial, you will learn how to create a google map and insert map in your page. How to create an API key for google map.

map.html

<!DOCTYPE html>
<html>
<body>

<h1>My First Google Map</h1>
<div id="googleMap" style="width:100%;height:400px;"></div>
<script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBCZn0MecaexSt8vn7rwN_MpVdIjhcTDKA&callback=myMap"></script>
</body>




function myMap() {
var mapProp= {
    center:new google.maps.LatLng(51.508742,-0.120850),
    zoom:5,
};
var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
}
</script>

</html>

No comments:

Post a Comment