Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Adding markers to google map...
<!DOCTYPE html>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: Simple Icons</title>
<link href="" rel="stylesheet" type="text/css" />
<script type="text/javascript" src=""></script>
<script type="text/javascript">
function initialize()
var myOptions = {
zoom: 4,
center: new google.maps.LatLng(-33, 151),
mapTypeId: google.maps.MapTypeId.ROADMAP
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var inputs = document.getElementsByTagName("input");
for(var i = 0; i < inputs.length; i++)
var latitudeAndLongitude = inputs[i].value.split(",");
var latitude = latitudeAndLongitude[0];
var longtitude = latitudeAndLongitude[1];
var myLatLng = new google.maps.LatLng(latitude, longtitude);
var image = "";
var beachMarker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image
<body onload="initialize()">
<div id="map_canvas"></div>
<input type="hidden" value="-33.890542,151.274856" />
<input type="hidden" value="-31.890542,151.274856" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.