Google Maps - JavaScript Help

I have a google map in which I load a kml overlay file.
Then I need a button on the page itself that could remove the overlay.

In google api manual it says to enable the layer you need to do this
var georssLayer = new google.maps.KmlLayer(''); georssLayer.setMap(map);
To DISABLE you need to do this
"You can hide a KmlLayer by setting this value to null within the setMap() method."

However if I do this on my page

it doesn't work.

I'm not really good with javascript.

Posted On: Tuesday 27th of November 2012 09:15:06 PM Total Views:  255
View Complete with Replies

Related Messages:

AJAX-autofill textbox using google geocode   (121 Views)
Hi , My name is Edward and I have question about AJAX, JSON, and google geocode. I have an assignment to create a webpage that has following text fields: name, street address, zip code, city, and state. The goal of this assignment is that when I fill the zip code-text field, the city and state will be automatically filled. For example, when I fill the zip-code with 94568, then the city will be Dublin, and the state will be CA. I don't know how can I connect the google geocode using the AJAX. Here is what I got so far: Homework 4 function fillCityState(zip){ if(document.getElementById("city").value !=""){ return false; } var xhr = new XMLHttpRequest();"GET",""+zip.value,true); if(xhr.readyState == 4){ var result = xhr.responseText; document.getElementById("city").value = result[0]; document.getElementById("state").value = result[1]; } xhr.send(null); } Name: Street Address: Zip Code: City: State: Could anybody help me Anyway this assignment has been submitted already, so I am asking this just for learning.
google map result display - sql+php   (208 Views)
Hi Everyone, I have integrated a Google Map on my website, which is working in good order. The maps data such as location lat/lng is coming from database. At present all the location markers are appearing on the map. I have a php page which draws out all the sql data and turns it into an xml domdocument which the map calls. ------------------------------------------------------------------------------------ what I need help with is how I can the result list appearing beside the map and when a user select a result it to appear on the map. Also a search form which will filter the result and display relevant markers. ------------------------------------------------------------------------------------ I would like to thank you in advance for taking your time in looking at my problem and hope i get the response i need. Thank you.
google maps API - place avatar   (71 Views)
How can i place a avatar image on google maps showing the position of a person based on latitude and longitude I am using google maps API for it.
add code that wont allow me to click on my own google ads   (101 Views)
Can I add code to my pages that will not allow me to click on my own google ads (accidentally). I would like to add this code so just in case I accidentally click on my own add it will not get counted.
refresh markers google maps   (106 Views)
Hi! I am new here. Sorry for my english, I am spanish and I am not so fluent as I should. I am developing a webpage and I want to keep updated some markers in google maps. I took these markers from a DB. I have a php file which creates a json and I take markers from it. For the moment I am able to show markers but I can't update them. I have tried lot of things and I don't know what more I can do. My php file is: json.php: $row['lat'], "lng" => $row['lng']); $x++; } //echo json_encode($data); //echo 'data='.json_encode($data),';'; echo '{"markers":'.json_encode($data),'}'; > And my webpage, for the moment, is: Google Maps var map; var markersArray = []; function initialize() { if (GBrowserIsCompatible()) { map = new google.maps.Map(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(43.4669443349282,-3.862788677215576),9); } GDownloadUrl("json.php", process_it); } function createMarker(point, map) { var marker = new GMarker(point, map); return marker; } // ================================================================ // === Define the function thats going to process the JSON file === function process_it(doc) { // === Parse the JSON document === var jsonData = eval('(' + doc + ')'); resetMarkers(markersArray); for (var i=0; i
blur() not working in google chrome?   (115 Views)
Guys, I am doing a simple example of autocomplete textbox.Well whenever I am typing anything in the textbox it shows me the existing options as we know the default functionality of autocomplete textbox. Now I need that when I select one of the options from the autocomplete list droping below the textbox the blur function should execute so that the focus should get away from the textbox. I have tried document.getElementById('text1').blur() but it is not working in chrome and safari. Do anyone have any idea how to do this or any other way to accomplish this
Iframe issue or google issue ??   (98 Views)
Guys i was loading in iframe till now!!! but from 2 days its not loading!!!!! any suggestions , and if theres any alternative to iframe please let me know .
search list as google from mysql   (127 Views)
I want to make search box like google. when typing in the text box it will show search list. the list must be from mysql query search. How can I do that.
Ajax Search as google?   (98 Views)
Hi frnds.... i am trying to do search like google.... my files r here......but it displays error.......plz check the code what the error error: error:'' is null or not an object. char:1. line:19. eg: in a text box type "a" then "a" related words r displayed... google.html google search function getData(dataSource) { var XMLHttpRequestObject = false; if(window.XMLHttpRequest){ XMLHttpRequestObject=new XMLHttpRequest(); }else if(window.ActiveXObject){ XMLHttpRequestObject=new ActiveXObject("Microsoft.XMLHTTP"); } if(XMLHttpRequestObject){"GET",dataSource); XMLHttpRequestObject.onreadystatechange=function(){ if(XMLHttpRequestObject.readyState ==4 && XMLHttpRequestObject.status==200){ eval(XMLHttpRequestObject.responseText);} } XMLHttpRequestObject.send(null); } } function connectGoogleSuggest(keyEvent){ var input=document.getElementById("textField"); if(input.value){ getData("google.phpqu=" +input.value); }else{ var targetDiv=document.getElementById("targetDiv"); targetDiv.innerHTML= ""; } } function sendRPCDone(unusedVariable,searchTerm,arrayTerm,arrayResults,unusedArray){ var data=""; var loopIndex; if(arrayResults.length !=0){ for(var loopIndex=0; loopIndex < arrayResults.length; loopIndex++){ data +="" + "" +arrayTerm[loopIndex] +'' + arrayResults[loopIndex] + ""; } } data +="" ; var targetDiv=document.getElementById("targetDiv"); targetDiv.innerHTML=data; }
google map key expiring   (109 Views)
google map key is expiring within 1 week even it shows expiration date for 1 year. I have generated gmap key 4 times. Every time it given validity for 1 year and expired within 1 week. Why this is happining
javascript masters.. i need help for my google map:(   (110 Views)
how can i change longitude and latitude of my google map can i use javascript for that i made website with google map api and it works with default value for longitude and is my concern, all i want is to change the location dynamically of my google map once i click one button. how can i do that pls help!!!
why it dosen't work in google chrome?   (113 Views)
, i got two list box that moving item within each other and they are operate by my "->" "
google ajax search api ( youtube videoBar)   (181 Views)
, I want to put youtube video bar in my website... and i already found the way to do it. Using google ajax search api. Google already provide the wizard to generate the code. The problem is, by default it shows only 4 videos for horizontal view. I am really having trouble to increase the video number.Can anyone suggest me any alternatives or some modifications. code snippet Loading... @import url(""); window._uds_vbw_donotrepair = true; @import url(""); .playerInnerBox_gsvb .player_gsvb { width : 320px; height : 260px; } function LoadVideoBar() { var videoBar; var options = { largeResultSet : !true, horizontal : true, autoExecuteList : { cycleTime : GSvideoBar.CYCLE_TIME_MEDIUM, cycleMode : GSvideoBar.CYCLE_MODE_LINEAR, executeList : ["ytfeed:most_viewed.this_week"] } } videoBar = new GSvideoBar(document.getElementById("videoBar-bar"), GSvideoBar.PLAYER_ROOT_FLOATING, options); } // arrange for this function to be called during body.onload // event processing GSearch.setOnLoadCallback(LoadVideoBar); , i found out that this lines of code is very useful var options = { largeResultSet : true, horizontal: true, i changed it to var options = { largeResultSet : false, horizontal: true, now i can have 8 videos huhu.., Gents hi, I am interested in adding a youtube facility to a website I am building, where users can search youtube from thier profile and have the videos played via the youtube player. can you point me in the right direction for an information regarding this, regards lloyd
previous page url in google crome using javascript   (127 Views)
how to get previous page url using javascript or jquery. i also tried document.referrer. but it didn't worked. can any one give me direction .
google map not working on server   (70 Views)
just confirming that you replaced the words my_key with the actual key given
how to custimzed Map type controls in google map   (74 Views)
i m using google map version 3. i want to customized the map type control show top-right corner.. i want to show all the type (map,statellite,terrain,earth) in one horizontal line (like its shown in V2). kindly guide me little..
landing page like google   (245 Views)
peeps! Any idea how to make a search result landing page like Google image result Like the one when you click one image it redirects you to an image preview first before it redirects to the source of that image. I was thinking it could be AJAX, but I'm not sure yet. Any ideas would be appreciated and could be a great help.
zRSSFeed error   (84 Views)
i started to use the zRSSFeed pluging, and it works nicely all of the RSS links i could think off, but when i try the RSS feed i get the error "Feed could not be loaded." the link i use is : can anybody help Im searching the web for whole 2 days and cant find any clue!
googlemaps - problem adding geocoding searchbox   (79 Views)
I've successfully set up on my website the example geocoded googlemap with markers from here: I now want to add a search box to geocode a typed in location, and re-center the map on that location. The following code works fine: Geocoding With a Map var map = null; var geocoder = null; function load() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(53.799637, -1.54911), 6); geocoder = new GClientGeocoder(); } } function findAddress(anAddress) { if (geocoder) { geocoder.getLatLng(anAddress, function(aPoint) { if (!aPoint) { alert("Sorry, can't locate [" + anAddress + "]"); } else { map.setCenter(aPoint, 13); var elem = document.getElementById("latLng"); elem.innerHTML = + ", " + aPoint.lng(); } }); } } Latitude/Logitude: 51.500789, -0.142264 However, when I try to insert this code into the map with markers, it doesn't work. When the location is typed into the search box, the map does not re-center. I've looked at the code until I've gone cross-eyed, and I just cannot figure out why it doesn't work. If anyone can help, I'd be really grateful.
igoogle style window drag & drop in diferent sections?   (81 Views)
how can i write a Java Script similar to igoogle style window drag & drop in diferent sections of a web page