+ 2

Hey can someone tell me the mistake i am doingin writing javascript of the HTML geolocation API

code isinserted below https://code.sololearn.com/WpJaLvJP7Agh/?ref=app

5th Mar 2018, 1:48 AM
DryUndead
DryUndead - avatar
3 Answers
+ 2
onload= function(){ var c = function(pos){ var lat = pos.coords.latitude, long = pos.coords.longitude, coords = lat + ', ' + long document.getElementById('google_map').setAttribute('src', 'https://maps.google.co.uk/?q=' + coords + '&z=60ouput=embed') } document.getElementById('get_location').onclick = function(){ navigator.geolocation.getcurrentposition(c); return false; } }
5th Mar 2018, 6:08 AM
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ 
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ  - avatar
+ 6
wrap your js code in onload=function(){ } and on the line 8 after function() there is a dot (.) rove that
5th Mar 2018, 2:24 AM
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ 
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ  - avatar
+ 3
u didn't wrapped your whole js code in onload =function (){ }
5th Mar 2018, 5:57 AM
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ 
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ  - avatar