javascript - Convert google mapv2 to v3 -


possible duplicate:
how put code in v3 instead v2 map

i have code , need convert in v3 google map code.

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">    <head>     <meta http-equiv="content-type" content="text/html; charset=utf-8"/>     <title>google maps ajax + mysql/php example</title>     <script src="http://maps.google.com/maps?file=api&v=2&key=abcdef"             type="text/javascript"></script>      <script type="text/javascript">     //<![cdata[     var map;     var geocoder;      function load() {       if (gbrowseriscompatible()) {         geocoder = new gclientgeocoder();         map = new gmap2(document.getelementbyid('map'));         map.addcontrol(new gsmallmapcontrol());         map.addcontrol(new gmaptypecontrol());         map.setcenter(new glatlng(40, -100), 4);       }     }     function searchlocations() {      var address = document.getelementbyid('addressinput').value;      geocoder.getlatlng(address, function(latlng) {        if (!latlng) {          alert(address + ' not found');        } else {          searchlocationsnear(latlng);        }      });    }     function searchlocationsnear(center) {      var radius = document.getelementbyid('radiusselect').value;      var searchurl = 'phpsqlsearch_genxml.php?lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius;      gdownloadurl(searchurl, function(data) {        var xml = gxml.parse(data);        var markers = xml.documentelement.getelementsbytagname('marker');        map.clearoverlays();         var sidebar = document.getelementbyid('sidebar');        sidebar.innerhtml = '';        if (markers.length == 0) {          sidebar.innerhtml = 'no results found.';          map.setcenter(new glatlng(40, -100), 4);          return;        }         var bounds = new glatlngbounds();        (var = 0; < markers.length; i++) {          var name = markers[i].getattribute('name');          var address = markers[i].getattribute('address');          var distance = parsefloat(markers[i].getattribute('distance'));          var point = new glatlng(parsefloat(markers[i].getattribute('lat')),                                  parsefloat(markers[i].getattribute('lng')));           var marker = createmarker(point, name, address);          map.addoverlay(marker);          var sidebarentry = createsidebarentry(marker, name, address, distance);          sidebar.appendchild(sidebarentry);          bounds.extend(point);        }        map.setcenter(bounds.getcenter(), map.getboundszoomlevel(bounds));      });    }      function createmarker(point, name, address) {       var marker = new gmarker(point);       var html = '<b>' + name + '</b> <br/>' + address;       gevent.addlistener(marker, 'click', function() {         marker.openinfowindowhtml(html);       });       return marker;     }      function createsidebarentry(marker, name, address, distance) {       var div = document.createelement('div');       var html = '<b>' + name + '</b> (' + distance.tofixed(1) + ')<br/>' + address;       div.innerhtml = html;       div.style.cursor = 'pointer';       div.style.marginbottom = '5px';        gevent.adddomlistener(div, 'click', function() {         gevent.trigger(marker, 'click');       });       gevent.adddomlistener(div, 'mouseover', function() {         div.style.backgroundcolor = '#eee';       });       gevent.adddomlistener(div, 'mouseout', function() {         div.style.backgroundcolor = '#fff';       });       return div;     }     //]]>    </script>   </head>    <body onload="load()" onunload="gunload()">     address: <input type="text" id="addressinput"/>       radius: <select id="radiusselect">        <option value="25" selected>25</option>       <option value="100">100</option>        <option value="200">200</option>      </select>      <input type="button" onclick="searchlocations()" value="search locations"/>     <br/>         <br/> <div style="width:600px; font-family:arial,  sans-serif; font-size:11px; border:1px solid black">   <table>      <tbody>        <tr id="cm_maptr">          <td width="200" valign="top"> <div id="sidebar" style="overflow: auto; height: 400px; font-size: 11px; color: #000"></div>          </td>         <td> <div id="map" style="overflow: hidden; width:400px; height:400px"></div> </td>        </tr>      </tbody>   </table> </div>       </body> </html> 

perhaps can start this: tips upgrading gmaps v2 v3 more quickly

then, if doesn't need go, edit question post have @ point , can try fix it.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -