Monday, October 12, 2009

Google maps embedded in a website that automatically read query string and go directly?

does anyone know how to make a very simple page of google map that when the page loads, it can automatically read querystring and show the map?





full javascript will be greatly appreciated
Google maps embedded in a website that automatically read query string and go directly?
Here's a simple example....





%26lt;html%26gt;


%26lt;head%26gt;


%26lt;script%26gt;


function mapGoogle(addyId) {


adVal = document.getElementById(addyId).value;


var gUrl = 'http://maps.google.com';


escapedAddy = escapeBlanks(adVal);


var loc = gUrl+'?q='+escapedAddy;


window.location = loc;


}


function escapeBlanks(adVal) {


eVal = '';


var last = adVal.length;


for (var i=0; i%26lt;last; i++) {


if (' ' == adVal.charAt(i)) {


eVal +='%20';


}


else {


eVal +=adVal.charAt(i);


}


}


return eVal;


}


%26lt;/script%26gt;


%26lt;/head%26gt;


%26lt;body%26gt;


%26lt;form%26gt;


Enter an address:


%26lt;input type="text" id="addy" /%26gt;



%26lt;input type="button"


value="click to map"


onclick="mapGoogle('addy');" /%26gt;


%26lt;/body%26gt;


%26lt;/html%26gt;

No comments:

Post a Comment

 

google maps Copyright 2008 All Rights Reserved Baby Blog Designed by Ipiet | Web Hosting