-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetLocation.js
More file actions
21 lines (17 loc) · 748 Bytes
/
getLocation.js
File metadata and controls
21 lines (17 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// var display;
//
// var getId = function(id)// a function that stores the value of display for success and failure's use
// {
// display = document.getElementById(id);
// locateme();
// }
var success = function (display, position) { // has been modified to take two parameters as input
display.innerHTML = position.coords.latitude + ":" + position.coords.longitude;
};
var failure = function(display, err) {
display.innerHTML = err.message;
};
var locateme = function(display) {
navigator.geolocation.getCurrentPosition(success.bind(null ,display), failure.bind(null, display)); //-> Needs 2 functinos that take only one parameter as input
};
// change a function that takes 2 parameters into a function that takes 1 para