xxxxxxxxxx
<html>
<head>
<title>Simple Map</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<style>
.leaflet-popup-close-button { display:none; }
fieldset { width:240px; }
#command {width: 300px; border: 2px solid black }
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id="map"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.min.js"></script>
<script src='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.css' rel='stylesheet' />
<script>
var allpoints = [[35, -118]];
// Provide your access token
L.mapbox.accessToken = 'pk.eyJ1IjoiY2piYXNzaW4iLCJhIjoiY2lnbnl5M2JlMDBkY21ma284MHpmYjdycSJ9.hCuiySWxJTct7nZvXRsiEQ';
// Create a map in the div #map
var map = L.mapbox.map('map', 'mapbox.streets').setView(allpoints[0], 5);
var marker = L.marker(allpoints[0]).addTo(map);
// create the control
// create the control
var lon = L.control({position: 'topright'});
lon.onAdd = function (map) {
var div = L.DomUtil.create('div', 'lon');
div.innerHTML = '<form><input id="lon" type="text"/></form>';
return div;
};
lon.addTo(map);
// add the event handler
function formInput() {
var point1 = document.getElementById("lon");
var points = point1.value.split(' ');
L.marker([points[1],points[0]]).addTo(map);
allpoints.push([points[1],points[0]]);
}
document.getElementById ("lon").addEventListener ("change", formInput, false);
</script>
</body>
</html>
Modified http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js to a secure url
https://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js
https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.js