Note that there are some explanatory texts on larger screens.

plurals
  1. POOn click of a marker the map need to be zoomed and multiple markers need to created at certain places
    primarykey
    data
    text
    <p>i have a problem on markers in google maps.</p> <p>The problem is i need to create multiple markers on the map on clicking of a particular marker on the map</p> <p>can u help me please....</p> <p>please help me....</p> <p>thanks</p> <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;%@page import="java.sql.*" %&gt; &lt;%! int i=1; Connection connection = null; boolean foundResults = false; ResultSet set = null; Statement statement = null; String city; String ip; String sysname; String sess; %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=utf-8"/&gt; &lt;title&gt;Google Maps API Sample&lt;/title&gt; &lt;script src="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;sensor=false&amp;amp;key=ABQIAAAAPDUET0Qt7p2VcSk6JNU1sBSM5jMcmVqUpI7aqV44cW1cEECiThQYkcZUPRJn9vy_TWxWvuLoOfSFBw" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;sensor=false&amp;amp;key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr6OwBovxn7TDAH5Q"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var map; var geocoder; var address=sel.options[sel.selectedIndex].value; document.write(address); function createMarker(point,html,what) { var test = address; var marker = new GMarker(point,{id:what, name:"foo", description:"baz"}); GEvent.addListener(marker, "click", function() { //marker.openInfoWindowHtml(html); window.location.href="/geomapMidware.jsp?"+test+""; }); return marker; } function initialize() { map = new GMap2(document.getElementById("map_canvas")); map.addControl(new GLargeMapControl()); map.addControl(new GScaleControl()); map.setCenter(new GLatLng(79, 0, true), 8); map.addControl(new GMenuMapTypeControl(true,false)); var point1 = map.getCenter(); var marker = createMarker(point1,'&lt;img src="printers-for-wire-and-network-elements-marking-43844.jpg" width="100" height="100"&gt;',"this") map.addOverlay(marker); geocoder = new GClientGeocoder(); } function addAddressToMap(response) { map.clearOverlays(); if (!response || response.Status.code != 200) { alert("Sorry, we were unable to geocode that address"); } else { place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); var test=address; var marker = createMarker(point,'&lt;a href="#"&gt;&lt;img src="printers-for-wire-and-network-elements-marking-43844.jpg" width="100" height="100"&gt;&lt;/a&gt;',"this"); //the above code can also written as following // var marker = createMarker(point,'&lt;form&gt;&lt;input type="button" name="b" value="Confirm" title="Click for Details" src="printers-for-wire-and-network-elements-marking-43844.jpg" width="100" height="100" onClick=find()&gt;&lt;/form&gt;',"this"); map.addOverlay(marker); marker.openInfoWindowHtml('&lt;b&gt;Coordinates:&lt;/b&gt;' + place.Point.coordinates); } } function showLocation(sel) { address = sel.options[sel.selectedIndex].value; var add1="Delhi" geocoder.getLocations(add1, addAddressToMap); //when i click on the marker the map should be zoomed } function findLocation(address) { showLocation(); } function find() { var test=address; //window.open("/Details.jsp?","winA","width=300,height=300,resizeable=no"); window.location.href="/geomapDetails.jsp?"+test+""; } &lt;/script&gt; &lt;/head&gt; &lt;body onload="initialize()" onunload="GUnload()" style="font-family: Arial;border: 0 none;"&gt; &lt;form name="f1" action="#" onsubmit="showLocation(); return false;"&gt; &lt;% try { Class c = Class.forName("org.postgresql.Driver"); connection = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres","postgres", "password"); statement = connection.createStatement(); set = statement.executeQuery("SELECT sno,city,ip,sysname FROM test"); while(set.next()) { } } catch(Exception e) { e.printStackTrace(); } %&gt; &lt;/form&gt; &lt;div id="map_canvas" style="width: 1250px; height: 740px" title="map"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>when i click on the marker the map should be zoomed</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload