javascript - Google Maps API - unexpected redirection -


I met the unexpected redirection for the local host: after executing this piece of xxxx / home / null code. What is the reason?

Here's my HTML:

  & lt; Div id = "userConsentSection" & gt; Can we use your geographic location? & Lt; Br / & gt; & Lt; Input type = "button" id = "yes" value = "yes" /> & lt; Input type = "button" id = "no" value = "no" /> gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt; / Div & gt; & Lt; Div id = "setCustomLocationSection" & gt; Enter your address manually & Lt; Br / & gt; & Lt; Input type = "text" id = "customLocation" /> & Lt; Input type = "button" id = "setCustomLocationButton" value = "show" /> & Lt; Br / & gt; & Lt; Br / & gt; & Lt; / Div & gt; & Lt; Div id = "map" style = "height: 450px; width: 720px" />  

JS:

  var map1 = null; Var location = null; Warning ("alert4"); Start function () {warning ("warning 5"); Hide $ ("#SetCustomLocationSection"). Var option = {center: new google.maps.LatLng (0, 0), zoom: 2} var marker = new google.maps.marker ({status: new google.maps.LatLng (0, 0), map: map , Title: "marker 0,0"}); Map1 = New google.maps.Map (document.getElementById ("map"), option) marker.setMap (map); } Warning ("Warning 3"); Click $ ("# yes") (function () {$ ("# userConsentSection"). Hide (); getPosition (); Reloadmap ();}); Click $ ("#No") (function () {$ ("# userConsentSection"). Hide (); ShowSetCustomLocationSection ();}); Function showSetCustomLocationSection () {$ ("#setCustomLocationSection"). Show (); } Function getPosition () {var option = {enableHighAccuracy: true, timeout: 20000, maximum edge: 2000} navigator.jivel cache .getCurrentPosition (showPosition, errorPosition, option); } Function showPosition (position) {if (position) {location = position.coords; }} Function error status (status) {switch (position.code) {case1: showSetCustomLocationSection (); break; Case 2: showSetCustomLocationSection (); break; Case 3: showSetCustomLocationSection (); break; Default: Break; }} Function reload map () {map1 = null; Var option = {center: new google.maps.LatLng (location.latitude, location.longitude), zoom: 8} map1 = new google.maps.Map (document.getElementById ("map"), option)} alert ("alert2 "); Google.maps.event.addDomListener (window, 'load', start);  

I have shown which codes are executed and which are not, it seems that there is something wrong with the last event method, but I do not know, no typo was found. is. Any ideas?

Location is a reserved word in JavaScript and is therefore redirected / Browser for position.coords;


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -