did your read this? http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/2b3f101fd509919e#
or your page is just local? On 26 Mrz., 18:26, Siddharth <siddharth98...@gmail.com> wrote: > I want to put a like and dislike button in the infowindow of the > marker in maps . I am not able to handle the event of like or dislike > button click . I want that when the button is clicked then that > information is entered into my database and the buttons disappear from > infowindow after that. I have put the javascript part of my code down > here : > > <% > Integer placeId=null; > %> > > function load(){ > > var map = new google.maps.Map(document.getElementById("map_canvas"), { > center: new google.maps.LatLng(12.95, 77.77), > zoom: 13, > mapTypeId: 'roadmap' > }); > > var infoWindow = new google.maps.InfoWindow; > > var customIcons = { > restaurant: { > icon: 'http://labs.google.com/ridefinder/images/ > mm_20_blue.png', > shadow: 'http://labs.google.com/ridefinder/images/ > mm_20_shadow.png' > }, > bar: { > icon: 'http://labs.google.com/ridefinder/images/ > mm_20_red.png', > shadow: 'http://labs.google.com/ridefinder/images/ > mm_20_shadow.png' > } > }; > > <% > Integer flag=0; > Integer i; > DocumentBuilderFactory docFactory = > DocumentBuilderFactory.newInstance(); > DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); > Document doc = docBuilder.parse("D:\\bar.xml"); > Element element = doc.getDocumentElement(); > NodeList personNodes = element.getElementsByTagName("marker"); > for(i=0;i<personNodes.getLength();i++) > { > flag=0; > > placeId=Integer.parseInt(personNodes.item(i).getAttributes().getNamedItem(" > id").getNodeValue()); > Integer userId=100000000; > String > lat=personNodes.item(i).getAttributes().getNamedItem("lat").getNodeValue(); > String > lng=personNodes.item(i).getAttributes().getNamedItem("lng").getNodeValue(); > String > type=personNodes.item(i).getAttributes().getNamedItem("type").getNodeValue( ); > String > address=personNodes.item(i).getAttributes().getNamedItem("address").getNode > Value(); > String > name=personNodes.item(i).getAttributes().getNamedItem("name").getNodeValue( ); > Integer > no_of_likes=Integer.parseInt(personNodes.item(i).getAttributes().getNamedIt > em("no_of_likes").getNodeValue()); > no_of_likes--; > Integer > no_of_dislikes=Integer.parseInt(personNodes.item(i).getAttributes().getName > dItem("no_of_dislikes").getNodeValue()); > no_of_dislikes--; > obj.init(); > obj.setPlaceId(placeId); > obj.setUserId(userId); > boolean lik=obj.isLiked(); > boolean dlik=obj.isDisiked(); > System.out.println("like:"+lik); > System.out.println("dislike:"+dlik); > if(lik) > flag=1; > if(dlik) > flag=2; > > %> > var j="<%=placeId%>"; > alert(j); > > var icon = customIcons["<%=type%>"] || {}; > > var html = "<b>" + > "<%=name%>" + > "</b> <br/>" + > "<%=address%>" + > "<br/> " + > "<% if(flag==0) { %>" + > "<button type='button' onclick=updateLike() > >Like</button>" + > "<button type='button' onclick=updateDislike() > >Dislike</button>" + > "<% } else if(flag==1) { %>" + > "<i>You</i> and <%=no_of_likes%> people liked it" + > "<% } else { %>" + > "<i>You</i> and <%=no_of_dislikes%> people disliked > it" + > "<% } %>"; > > var marker = new google.maps.Marker({ > map: map, > position: new google.maps.LatLng(parseFloat(<%=lat > %>),parseFloat(<%=lng%>)), > icon: icon.icon, > shadow: icon.shadow, > title: "Hello World!" > }); > > bindInfoWindow(marker, map, infoWindow, html); > > <%}%> > > } > > function bindInfoWindow(marker, map, infoWindow, html) { > google.maps.event.addListener(marker, 'click', function() { > infoWindow.setContent(html); > infoWindow.open(map, marker); > }); > } > > function updateLike(){ > <% > obj.setPlaceId(placeId); > obj.updateLike(); > %> > } > > function updateDislike(){ > <%obj.updateDislike();%> > } > > In the code above obj is the ID of the jsp bean , with which i am > calling the function to insert the data into my database . But on > click the data is not entering . Plz help !!! -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.