Google Maps - JavaScript Help


hi.
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('http://api.flickr.co...mat=feed-georss'); 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:  411
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




AJAX-autofill textbox using google geocode

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(); xhr.open("GET","http://maps.googleapis.com/maps/api/jsonzip="+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.
VIEWS ON THIS POST

308

Posted on:

Monday 19th November 2012
View Replies!

google map result display - sql+php

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.
VIEWS ON THIS POST

426

Posted on:

Monday 19th November 2012
View Replies!

google maps API - place avatar

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.
VIEWS ON THIS POST

149

Posted on:

Wednesday 21st November 2012
View Replies!

add code that wont allow me to click on my own google ads

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.
VIEWS ON THIS POST

246

Posted on:

Wednesday 21st November 2012
View Replies!

refresh markers google maps

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
VIEWS ON THIS POST

274

Posted on:

Wednesday 21st November 2012
View Replies!

blur() not working in google chrome?

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
VIEWS ON THIS POST

259

Posted on:

Wednesday 21st November 2012
View Replies!

Iframe issue or google issue ??

Guys i was loading google.com in iframe till now!!! but from 2 days its not loading!!!!! any suggestions , and if theres any alternative to iframe please let me know .
VIEWS ON THIS POST

222

Posted on:

Saturday 24th November 2012
View Replies!

search list as google from mysql

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.
VIEWS ON THIS POST

274

Posted on:

Saturday 24th November 2012
View Replies!

Ajax Search as google?

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:'window.google.ac' 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){ XMLHttpRequestObject.open("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; }
VIEWS ON THIS POST

195

Posted on:

Saturday 24th November 2012
View Replies!

google map key expiring

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
VIEWS ON THIS POST

195

Posted on:

Sunday 25th November 2012
View Replies!

javascript masters.. i need help for my google map:(

how can i change longitude and latitude of my google map can i use javascript for that\t\t i made website with google map api and it works with default value for longitude and latitude...here 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\t pls help!!!
VIEWS ON THIS POST

211

Posted on:

Sunday 25th November 2012
View Replies!

why it dosen't work in google chrome?

, i got two list box that moving item within each other and they are operate by my "->" "
VIEWS ON THIS POST

259

Posted on:

Sunday 25th November 2012
View Replies!

google ajax search api ( youtube videoBar)

, 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. http://www.google.com/uds/solutions/wizards/videobar.html 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("http://www.google.com/uds/css/gsearch.css"); window._uds_vbw_donotrepair = true; @import url("http://www.google.com/uds/solutions/videobar/gsvideobar.css"); .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
VIEWS ON THIS POST

345

Posted on:

Sunday 25th November 2012
View Replies!

previous page url in google crome using javascript

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 .
VIEWS ON THIS POST

276

Posted on:

Monday 26th November 2012
View Replies!

google map not working on server

just confirming that you replaced the words my_key with the actual key given
VIEWS ON THIS POST

131

Posted on:

Monday 26th November 2012
View Replies!

how to custimzed Map type controls in google map

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..
VIEWS ON THIS POST

128

Posted on:

Monday 26th November 2012
View Replies!

landing page like google

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.
VIEWS ON THIS POST

372

Posted on:

Monday 26th November 2012
View Replies!

zRSSFeed news.google error

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 news.google RSS feed i get the error "Feed could not be loaded." the link i use is : http://news.google.com/newspz=1&cf=all&ned=iw_il&hl=iw&output=rss can anybody help\t Im searching the web for whole 2 days and cant find any clue!
VIEWS ON THIS POST

183

Posted on:

Monday 26th November 2012
View Replies!

googlemaps - problem adding geocoding searchbox

I've successfully set up on my website the example geocoded googlemap with markers from here: http://code.google.com/support/bin/answer.pyanswer=65622 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.lat() + ", " + 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.
VIEWS ON THIS POST

152

Posted on:

Monday 26th November 2012
View Replies!

igoogle style window drag & drop in diferent sections?

how can i write a Java Script similar to igoogle style window drag & drop in diferent sections of a web page
VIEWS ON THIS POST

132

Posted on:

Tuesday 27th November 2012
View Replies!