-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.js
44 lines (33 loc) · 1.11 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function afterInit () {
function addMarker (lat, lng, title = "Marker") {
const position = new google.maps.LatLng(lat, lng);
const marker = new google.maps.Marker({position, title});
const map = document.getElementById('map');
marker.setMap(map);
}
var params = new URLSearchParams(document.location.search);
const { Latitude, Longitude } = params;
addMarker(Latitude, Longitude);
}
function createInputField (name) {
const label = document.createElement('label');
label.setAttribute('for', name);
label.innerHTML = name;
const input = document.createElement('input');
input.setAttribute('id', name);
input.setAttribute('name', name);
input.setAttribute('class', 'form-control');
const form = document.querySelector('form');
form.appendChild(label);
form.appendChild(input);
}
const inputFields = [
'Latitude',
'Longitude',
];
inputFields.forEach(createInputField);
const submit = document.createElement('input');
submit.setAttribute('type', 'submit');
submit.setAttribute('class', 'my-3 btn btn-primary');
document.querySelector('form').appendChild(submit);
// =====================================