JavaScript - The Same Info Window Opens For All Google Markers On Map
For my Javascript class, we are to take a code from the book and add on to it. In this code, I decided to add custom markers and info windows for each location. I got the info windows to work but they are the same for each marker. How can I fix this? Here is what I have:
Code: <script> function init() { var myLatLng = new google.maps.LatLng(36.795209, -3.339844); var myOptions = { zoom: 2, center: myLatLng }; var map = new google.maps.Map(document.getElementById("map"), myOptions); //This is Location 1 var image = 'image1.jpg'; var canyon= new google.maps.Marker({ position: new google.maps.LatLng(35.9766,-113.7717), map: map, title:"Grand Canyon, USA"}); var infoWindow = new google.maps.InfoWindow({ content: "Grand Canyon, USA"}); google.maps.event.addListener(canyon, 'click', function(){ infoWindow.open(map, canyon); }); //This is Location 2 var image = 'image2.jpg'; var paricutin= new google.maps.Marker({ position: new google.maps.LatLng(19.5948,-102.4331), map: map, title:"Paricutin, Mexico"}); var infoWindow = new google.maps.InfoWindow({ content: "Paricutin, Mexico"}); google.maps.event.addListener(paricutin, 'click', function(){ infoWindow.open(map, paricutin); }); //This is Location 3 var image = 'image3.jpg'; var victoria= new google.maps.Marker({ position: new google.maps.LatLng(-17.928,25.826), map: map, title:"Victoria Falls, Zimbabwe"}); var infoWindow = new google.maps.InfoWindow({ content: "Victoria Falls, Zimbabwe"}); google.maps.event.addListener(victoria, 'click', function(){ infoWindow.open(map, victoria); }); //This is Location 4 var image = 'image4.jpg'; var reef= new google.maps.Marker({ position: new google.maps.LatLng(-17.98,146.76), map: map, title:"Great Barrier Reef, Austrailia"}); var infoWindow = new google.maps.InfoWindow({ content: "Great Barrier Reef, Austrailia"}); google.maps.event.addListener(reef, 'click', function(){ infoWindow.open(map, reef); }); //This is Location 5 var image = 'image5.jpg'; var harbor= new google.maps.Marker({ position: new google.maps.LatLng(-22.8424,-43.1502), map: map, title:"Harbor Rio De Janerio, Brazil"}); var infoWindow = new google.maps.InfoWindow({ content: "Harbor Rio De Janerio, Brazil"}); google.maps.event.addListener(harbor, 'click', function(){ infoWindow.open(map, harbor); }); //This is Location 6 var image = 'image6.jpg'; var everest= new google.maps.Marker({ position: new google.maps.LatLng(27.98783,86.92476), map: map, title:"Mount Everest Peak, Nepal"}); var infoWindow = new google.maps.InfoWindow({ content: "Mount Everest Peak, Nepal"}); google.maps.event.addListener(everest, 'click', function(){ infoWindow.open(map, everest); }); } google.maps.event.addDomListener(window, 'load', init); </script> Similar TutorialsI am no javascript coder so apologies for what may be a simple issue, I have a php page that pulls MySQL marker locations I have tried using examples for bounds etc but the map isn't centered or zoomed, it instead seems to center over the Pacific and minimum zoom level (For the url below it should be centered over the Devon region of the UK and zoomed in) the page where you can see the end result is he http://www.peugeotcentral.co.uk/modu...tches&Region=1 I did have some issues in my code whereby I was using deprecated function of GPoint for passing locations but one of the group mods kindly pointed this out and this was replaced with GLatLng but the fault is still there any help much appreciated, I do have the source code for the php if required I am trying to make google maps zoom to fit markers, I made this super simple example that should work but blows up when it comes time to create the LatLngList Array. I'm using this guys code that everyone says works:http://blog.shamess.info/2009/09/29/...e-maps-api-v3/ Code: <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Google Maps JavaScript API v3 Example: Marker Simple</title> <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyBFaOhZzSroCxheTo9stXtkicU3bNHwcho&sensor=false"></script> <script type="text/javascript"> function initialize() { var myLatlng = new google.maps.LatLng(-25.363882,131.044922); var myOptions = { zoom: 4, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var marker = new google.maps.Marker({ position: myLatlng, map: map, title:"Hello World!" }); // Make an array of the LatLng's of the markers you want to show var LatLngList = array (new google.maps.LatLng (52.537,-2.061), new google.maps.LatLng (52.564,-2.017)); // Create a new viewpoint bound var bounds = new google.maps.LatLngBounds (); // Go through each... for (var i = 0, LtLgLen = LatLngList.length; i < LtLgLen; i++) { // And increase the bounds to take this point bounds.extend (LatLngList[i]); } // Fit these bounds to the map map.fitBounds (bounds); } </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width:650px;height:550px;"></div> </body> </html> Hello I need some help with Google Maps please. Im using Google Maps API V3. So I can create a simple map but what I need is to have two markers (which are quite far apart) on the map. For example these markers are called 'Marker 1' and 'Marker 2'. Below the map I would have 2 links called for example 'Marker 1 link' and 'Marker 2 link'. When the map loads, 'Marker 1' is visible and centered. Now to move to 'Marker 2' on the map, I would click the link under the map. And vice versa. A good example is http://arts.brighton.ac.uk/contact-u...aculty-of-arts I tried but failed when I tried this guys answer on this website: http://stackoverflow.com/questions/2...utside-the-map Any help to create this is greatly appreciated! Hi, not sure if this is quite the right forum to ask this, but it is a javascript function after all so I thought I'd give it a shot. Here's the problem: I have an array of latitude/longitude data. I need to make a marker appear on the map for each lat/lng pair. But it won't. If I ask the function to print out the coordinates instead of marking them on the, map, it works fine. I don't get an error message either way, so I'm stuck. The page displays the map but without any markers. Here's the code of the function that should add markers: Code: //adds markers to the map function addMarkers(locarray) { var infowindow = new google.maps.InfoWindow(); var marker, i; for (i = 0; i < locarray.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(locarray[i][0], locarray[i][1]), map: map }); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent('some words'); infowindow.open(map, marker); } })(marker, i)); } } Here's the initialize function (called on body load): Code: function initialize() { geocoder = new google.maps.Geocoder(); var latlng = codeAddress("<?php echo $_POST['postal']; ?>"); var myOptions = { zoom: 11, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); } geocoder and map are declared as global variables. The codeAddress function returns lat and lng of the place I want to center the map around, it's been tested and works perfectly. And here is the script that declares the array and calls the addMarkers function: Code: <script type='text/javascript'> var locations = [ [-33.890542, 151.274856], [-33.923036, 151.259052], [-34.028249, 151.157507], ]; addMarkers(locations) </script> Does anyone see anything wrong with this? Fellow Coders, I am trying to follow this tutorial (http://econym.org.uk/gmap/basic16.htm) What I would like to do is have in my XML file, a parameter for a total (some random number) and I want to plot a marker based on this number. So like, if the total="5" then marker would be red, if it was 10, marker would be green. I see in the tutorial that they are storing the possible markers in an array, I get that. What I don't know how to do is plot the markert depending on the value of the total field in the XML file. Hi guys. I have posted about this before on here but I'm still having a lot of issues. MY GOAL - I have a database with a bunch of items and each has latitude, longitude and a category (all the items are within 1 city). I want to have a page that will show a google map, display a marker based on the lat/lng and the image of the marker should be customized based on the category of the row. For example, some rows have a 'food' category and some have a 'health' category - I have specific images I want displayed for each image. I need a script that will plot a marker for each item in my db. I have never used Google maps API before and I'm thinking V3 is what I need to use. Can someone help fill in the code below? PHP Code: $query=mysql_query("SELECT * FROM table"); while($row=mysql_fetch_array($query)){ $lat=$row['lat']; $lng=$row['lng']; $category=$row['category']; //SET MARKER PICTURE TO $category //ADD MARKER TO MAP } Can anybody help out with the code? I don't know javascript that well and I have tried about 40 different things and get nothing but a blank page! THANK YOU SO MUCH I pulled this code from Google's example section to make markers on a v3 Google Maps API (I have added my own lat/long points and corresponding event listeners, of course, but this is still the spirit of the code):
Code: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var map; function initialize() { var map_center = new google.maps.LatLng(39.2,-84.479381); var store1 = new google.maps.LatLng(39.112456,-84.574779); var store2 = new google.maps.LatLng(39.314153,-84.261379); var store3 = new google.maps.LatLng(39.197099,-84.667579); var store4 = new google.maps.LatLng(39.16836,-84.479381); var myOptions = { zoom: 10, center: map_center, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var marker1 = new google.maps.Marker({ position: store1, map: map, title:"Store 1" }); var marker2 = new google.maps.Marker({ position: store2, map: map, title:"Store 2" }); var marker3 = new google.maps.Marker({ position: store3, map: map, title:"Store 3" }); var marker4 = new google.maps.Marker({ position: store4, map: map, title:"Store 4" }); google.maps.event.addListener(marker1, 'click', function() { map.set_center(store1); map.set_zoom(16); }); google.maps.event.addListener(marker2, 'click', function() { map.set_center(store2); map.set_zoom(16); }); google.maps.event.addListener(marker3, 'click', function() { map.set_center(store3); map.set_zoom(16); }); google.maps.event.addListener(marker4, 'click', function() { map.set_center(store4); map.set_zoom(16); }); } </script> This works without fail, but when I try to use a javascript array to hold my values and loop my way through the marker creation like so: Code: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var map; function initialize() { var map_center = new google.maps.LatLng(39.2,-84.479381); var store_locations = new Array(); var temporary_stuff = new Array(); store_locations[0] = "39.112456,-84.574779"; store_locations[1] = "39.314153,-84.261379"; store_locations[2] = "39.197099,-84.667579"; store_locations[3] = "39.16836,-84.479381"; var myOptions = { zoom: 10, center: map_center, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); for(i=0;i<store_locations.length;i++){ var marker_string = "position: "+new google.maps.LatLng(store_locations[i])+", map: map, title:\"Store "+(i+1)+"\";"; temporary_stuff[i] = new google.maps.Marker(marker_string); } var markers = new Array(); for(i=0;i<temporary_stuff.length;i++){ var the_marker = "position: temporary_stuff[" + i + "], map: map, title:\"Store " + (i+1) + "\";"; markers[i]= new google.maps.Marker(the_marker); } } </script> I get a blank map. Here's a link to the test file: http://rowsdower.freehostia.com/map_test.php It's not throwing up any errors in Firefox's developer or in IE but there it sits, a blank map. I'm sure this isn't clean or optimized code, but it looks correct to me. I've color-coded the code above to show what "for" loops are being used to try to replace which code. Hopefully that makes this more sensible. I haven't even tried to add the listeners yet since I can't get the markers to appear. Can anyone tell me why this isn't working or point me in a more productive direction? Is there a better way already out there that I haven't noticed? Firstly I know this is a PHP issue yet it is within javascript and IMO is the root cause of the problem. I'm trying to output markers from a search query of locations from my database, onto a Google Map (api v.3) using a tut I found http://tips4php.net/2010/10/use-php-...g-data-on-map/ When adding this to my page I'm getting Undefined index:errors. I have changed the variables in the php part of the script to suit my database yet have left everything else alone, cant figure out why I'm still getting a blank map???? Please help.... My code with errors being shown at bottom; Code: <script src="http://maps.google.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script> <script type="text/javascript"> var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png", new google.maps.Size(32, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 32)); var center = null; var map = null; var currentPopup; var bounds = new google.maps.LatLngBounds(); function addMarker(lat, lng, info) { var pt = new google.maps.LatLng(lat, lng); bounds.extend(pt); var marker = new google.maps.Marker({ position: pt, icon: icon, map: map }); var popup = new google.maps.InfoWindow({ content: info, maxWidth: 300 }); google.maps.event.addListener(marker, "click", function() { if (currentPopup != null) { currentPopup.close(); currentPopup = null; } popup.open(map, marker); currentPopup = popup; }); google.maps.event.addListener(popup, "closeclick", function() { map.panTo(center); currentPopup = null; }); } function initMap() { map = new google.maps.Map(document.getElementById("map"), { center: new google.maps.LatLng(0, 0), zoom: 14, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR }, navigationControl: true, navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL } }); <br /> <b>Notice</b>: Undefined index: name in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>73</b><br /> <br /> <b>Notice</b>: Undefined index: lng in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>75</b><br /> <br /> <b>Notice</b>: Undefined index: info in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>76</b><br /> addMarker(53.994709, ,'<b></b><br/>'); <br /> <b>Notice</b>: Undefined index: name in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>73</b><br /> <br /> <b>Notice</b>: Undefined index: lng in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>75</b><br /> <br /> <b>Notice</b>: Undefined index: info in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>76</b><br /> addMarker(53.985416, ,'<b></b><br/>'); <br /> <b>Notice</b>: Undefined index: name in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>73</b><br /> <br /> <b>Notice</b>: Undefined index: lng in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>75</b><br /> <br /> <b>Notice</b>: Undefined index: info in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>76</b><br /> addMarker(53.985416, ,'<b></b><br/>'); <br /> <b>Notice</b>: Undefined index: name in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>73</b><br /> <br /> <b>Notice</b>: Undefined index: lng in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>75</b><br /> <br /> <b>Notice</b>: Undefined index: info in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>76</b><br /> addMarker(0.000000, ,'<b></b><br/>'); <br /> <b>Notice</b>: Undefined index: name in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>73</b><br /> <br /> <b>Notice</b>: Undefined index: lng in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>75</b><br /> <br /> <b>Notice</b>: Undefined index: info in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>76</b><br /> addMarker(0.000000, ,'<b></b><br/>'); center = bounds.getCenter(); map.fitBounds(bounds); } </script> Hi guys, so far any values recorded in my database are shown on the map: http://www.vfrflight.co.uk/new2/phpsqlajax_map_v3.html Code: <!DOCTYPE html > <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>PHP/MySQL & Google Maps Example</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> //<![CDATA[ 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' } }; function load() { var map = new google.maps.Map(document.getElementById("map"), { center: new google.maps.LatLng(47.6145, -122.3418), zoom: 13, mapTypeId: 'roadmap' }); var infoWindow = new google.maps.InfoWindow; // Change this depending on the name of your PHP file downloadUrl("phpsqlajax_genxml.php", function(data) { var xml = data.responseXML; var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { var name = markers[i].getAttribute("name"); var address = markers[i].getAttribute("address"); var type = markers[i].getAttribute("type"); var point = new google.maps.LatLng( parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var html = "<b>" + name + "</b> <br/>" + address; var icon = customIcons[type] || {}; var marker = new google.maps.Marker({ map: map, position: point, icon: icon.icon, shadow: icon.shadow }); 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 downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request, request.status); } }; request.open('GET', url, true); request.send(null); } function doNothing() {} //]]> </script> </head> <body onload="load()"> <div id="map" style="width: 500px; height: 300px"></div> </body> </html> However, how do i let people place markers when a button is pressed. I believe this is the code to place markers when left click occurs: Code: <!DOCTYPE html > <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Google Maps JavaScript API v3 Example: Map Simple</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var marker; var infowindow; function initialize() { var latlng = new google.maps.LatLng(37.4419, -122.1419); var options = { zoom: 13, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), options); var html = "<table>" + "<tr><td>Name:</td> <td><input type='text' id='name'/> </td> </tr>" + "<tr><td>Address:</td> <td><input type='text' id='address'/></td> </tr>" + "<tr><td>Type:</td> <td><select id='type'>" + "<option value='bar' SELECTED>bar</option>" + "<option value='restaurant'>restaurant</option>" + "</select> </td></tr>" + "<tr><td></td><td><input type='button' value='Save & Close' onclick='saveData()'/></td></tr>"; infowindow = new google.maps.InfoWindow({ content: html }); google.maps.event.addListener(map, "click", function(event) { marker = new google.maps.Marker({ position: event.latLng, map: map }); google.maps.event.addListener(marker, "click", function() { infowindow.open(map, marker); }); }); } function saveData() { var name = escape(document.getElementById("name").value); var address = escape(document.getElementById("address").value); var type = document.getElementById("type").value; var latlng = marker.getPosition(); var url = "phpsqlinfo_addrow.php?name=" + name + "&address=" + address + "&type=" + type + "&lat=" + latlng.lat() + "&lng=" + latlng.lng(); downloadUrl(url, function(data, responseCode) { if (responseCode == 200 && data.length <= 1) { infowindow.close(); document.getElementById("message").innerHTML = "Location added."; } }); } function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request.responseText, request.status); } }; request.open('GET', url, true); request.send(null); } function doNothing() {} </script> </head> <body style="margin:0px; padding:0px;" onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="message"></div> </body> </html> Help would be appreicated very much! I cannot combine the codes to save my life... I have written base rel="nofollow" target="_self" tag in head tag. It works fine in IE6 but not in IE8. window.showModalDialog() opens up new ModalDialog instead of using existing Dialog. Can anybody help me?
I'm looking at creating a set of customer contact forms. I'd like to be able to have a main contact page where the visitor fills in general info like name and such, and then clicks a link to get into the specific area form he needs. I've done VB programming and used it to manipulate an IE document object. I've explored JavaScript and managed to code one or two IF functions. I'm wondering if I open the linked form in a new window, can I use JS to pull the info from the first window and insert it into the new window? Seems like it would be easy, but I don't know so I'm asking. (MasterofFollies gave me a PHP solution in http://www.codingforums.com/showthread.php?t=187819 , but I havene't had any time at all to give myself to understanding it!) Ed hi On my map, I have several markers, see my code: Code: <script language="JavaScript" type="text/javascript"> function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); var locationIcon = new GIcon(G_DEFAULT_ICON); //both images must be the same size locationIcon.image = "images/google-pin.png"; locationIcon.shadow = "images/google-pin-shadow.png"; locationIcon.iconSize = new GSize(90, 70); locationIcon.shadowSize = new GSize(90, 70); markerOptions = { icon:locationIcon }; map.setCenter(new GLatLng(51.3992613899243,-1.32983778443008), 8); // center point between the 2 map.addOverlay(new GMarker(new GLatLng(51.4769752333875,-2.53517458867092), markerOptions)); //BS16 3HH map.addOverlay(new GMarker(new GLatLng(50.8391656924497,-0.154312843280554), markerOptions)); // BN1 5PT map.addOverlay(new GMarker(new GLatLng(50.8340528225749,-0.259947032613667), markerOptions)); // BN43 6NZ map.addOverlay(new GMarker(new GLatLng(51.5168824045344,-2.6926718990779), markerOptions)); // BS11 9YQ map.addOverlay(new GMarker(new GLatLng(50.954582894922,-0.145016932400171), markerOptions)); // RH15 9LR } } //51.514925,-0.150118 W1U 1JQ //51.497593,-0.164806 SW3 1NQ </script> I would like to add an info bubble for each of my markers, would I add this piece of code somewhere within my code: Code: GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml("<table width='215'><tr><td><a rel="nofollow" target='_blank' href='http://www.lcls.org/'>Lewis & Clark Library System</a></td></tr><tr><td><img src='http://www.lcls.org/images/galleries/tour/01-BuildingFromLot.JPG' border='0' width='195px' height='95' /></td></tr><tr><td>425 Goshen Road<br />Edwardsville,IL 62025<br />618-656-3216</td></tr></table><br /><a rel="nofollow" target='_blank' href='http://maps.google.com/maps?q=425 Goshen Road%20Edwardsville,%20IL'>Directions</a>"); }); I've been trying for some time now to create some code which dynamically adds markers to a google map. I've now managed this but I still have a slight problem I think with the javascript side of things. I've included a snippet of the code which shows 2 markers on the map. They should be 2 different markers but they are the same, and the contents of the popup bubble should be each individual postcode, but they both show the same postcode. Does anyone have any ideas? Thanks Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Geocoding UK Postcodes with Google APIs Demo</title> <style type="text/css"> html { height: 100%; } body { margin: 0; padding: 0; height: 100%; } #map { width: 100%; height: 100%; z-index:1; } </style> <script src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=ABQIAAAAQJTCOfFBzEZfb0xYTu1h_BR0_9owy9VLLEJCKI_ZedHr-0NdXxQd9Q8sR1hC7s4PNGNVmIaTUQvspA" type="text/javascript"></script> <script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAQJTCOfFBzEZfb0xYTu1h_BR0_9owy9VLLEJCKI_ZedHr-0NdXxQd9Q8sR1hC7s4PNGNVmIaTUQvspA" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ var icon2 = new GIcon(); icon2.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png"; icon2.shadow = "http://www.google.com/mapfiles/shadow50.png"; icon2.iconSize = new GSize(32, 32); icon2.shadowSize = new GSize(37, 34); icon2.iconAnchor = new GPoint(16, 32); icon2.infoWindowAnchor = new GPoint(16, 0); var icon3 = new GIcon(); icon3.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png"; icon3.shadow = "http://www.google.com/mapfiles/shadow50.png"; icon3.iconSize = new GSize(32, 32); icon3.shadowSize = new GSize(37, 34); icon3.iconAnchor = new GPoint(16, 32); icon3.infoWindowAnchor = new GPoint(16, 0); var localSearch = new GlocalSearch(); function initialize() { if (GBrowserIsCompatible()) { map = new GMap(document.getElementById("map")); map.setCenter(new GLatLng(55.100651, -4.664941), 6); } } function createMarker(point2,html) { var marker2 = new GMarker(point2,icon2); GEvent.addListener(marker2, "click", function() { marker2.openInfoWindowHtml(html, { noCloseOnClick: true }); }); return marker2; } function createMarker2(point3,html) { var marker3 = new GMarker(point3,icon3); GEvent.addListener(marker3, "click", function() { marker3.openInfoWindowHtml(html, { noCloseOnClick: true }); }); return marker3; } //]]> </script> </head> <body> <div id="map"><script type="text/javascript">document.write(initialize())</script></div> <script type="text/javascript"> var thetext = 'LL58 8HU' localSearch.execute("LL58 8HU, UK"); localSearch.setSearchCompleteCallback(null, function() { map.addOverlay(createMarker(new GLatLng(localSearch.results[0].lat,localSearch.results[0].lng),thetext)); }); </script> <script type="text/javascript"> var thetext2 = 'RG4 6UT' localSearch.execute("RG4 6UT, UK"); localSearch.setSearchCompleteCallback(null, function() { map.addOverlay(createMarker2(new GLatLng(localSearch.results[0].lat,localSearch.results[0].lng),thetext2)); }); </script> </body> </html> hi, I am following the tutorial on Windows Live App API from he http://isdk.dev.live.com/ISDK.aspx?c...ncepts&index=0 and I have added my Client ID got a login system working and allowing information to be passed through but I cannot display the user that's currently logged in, here is my page: link: http://www.trialsevolution.co.uk/app/ code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Greeting the User Test page</title> <link rel="stylesheet" type="text/css" href="style.css" /> <script src="https://js.live.net/v5.0/wl.js" type="text/javascript"></script> <script type="text/javascript"> var APPLICATION_CLIENT_ID = "000000004805DA23", REDIRECT_URL = "http://www.trialsevolution.co.uk/app/home.html"; WL.Event.subscribe("auth.login", onLogin); WL.init({ client_id: 00000000000000, redirect_uri: "http://www.trialsevolution.co.uk/app/home.html", response_type: "token" }); WL.ui({ name: "signin", element: "signInButton" }); function greetUser(session) { var strGreeting = "welcome"; WL.api( { path: "me", method: "GET" }, function (response) { if (!response.error) { strGreeting = "Hi, " + response.first_name + "!" document.getElementById("greeting").innerHTML = strGreeting; } }); } function setMeImage(token) { var imgHolder = document.getElementById("meimg"), imgTagString = ""; if (token != null) { var url = "https://apis.live.net/v5.0/me/picture?oauth_token=" + escape(token); imgTagString = "<img src='" + url + "' />"; } imgHolder.innerHTML = imgTagString; } function onLogin() { var session = WL.getSession(); if (session){ greetUser(session); setMeImage(session.access_token); } } </script> </head> <body> <p>Sign in to display a welcome greeting.</p> <div id="meimg"></div> <div id="greeting"></div> <div id="signInButton"></div> </body> </html> Hi. I have a page in a modal window that fades in over the top of my site when clicked. When this page comes up in Google and is clicked it does not load up the site with the modal window over top, it just loads the content of the modal window on a full page. Is there a way to have the link on Google go to the page with the modal window over top? The modal window is "PrettyPhoto" using JQuery. Thanks in advance. Hi Friends, I am really tired with Chrome , one of my window.open() Stuff work fine in FF and Opera in Fedora O.S. But Chrome Did not , my code is like: <script type="text/javascript"> function getpage(id, type){ $.ajax({ type: "POST", data: "key="+id, async: false, url: "<?php echo site_url(); ?>/server/precp/"+type, success: function (msg) { window.open("<?php echo site_url(); ?>/server/cplogin/"+msg, "autologin"); } }); } </script> and it call in another JavaScript function like: function doKeyup(id,e) { if(e == 13) { //alert("e:"+e); var cp = $("table#serverdata tbody tr#container_tr.row_no td:nth-child(7) a#cp").html(); var dc = $("table#serverdata tbody tr#container_tr.row_no td:nth-child(7) a#dc").html(); if(cp != null || dc != null ) { var firstId = $("table#serverdata tbody tr#container_tr.row_no td:nth-child(1) input[type=checkbox]").val(); } if(cp != null) { alert("Enter here"); getpage(firstId,'cp'); return false; } and it firstly call from onkeyup as : <input type="text" name="find_text0" id="find_text0" autocomplete="off" <?php if ('B' == $sb_pos) { ?> onfocus="document.getElementById('find_text1').value='';" <?php } ?> onkeyup = "return doKeyup('0',event.keyCode);" /> Please Give me a Solution ASAP. Thankfully Anes I'm having trouble getting Google Chrome to print the correct content when I change the content of a modal page with JavaScript. This is my code: JavaScript: Code: function printCoupon(couponID) { var originalContents = document.body.innerHTML; var printable = document.getElementById(couponID); var printContents = printable.innerHTML; document.body.innerHTML = printContents; window.print(); document.body.innerHTML = originalContents; document.getElementById(couponID).scrollIntoView(true); } HTML: Code: <body> <div id="coupon1"><p>Coupon 1 contents</p></div> <div><a href="javascript:void(0)" onclick="printCoupon('coupon1');return false;">Print Coupon</a></div> <div id="coupon2"><p>Coupon 2 contents</p></div> <div><a href="javascript:void(0)" onclick="printCoupon('coupon2');return false;">Print Coupon</a></div> </body> This works in IE8 and FF 3.6, but Chrome 16 prints the original content, not the printable content. UPDATE: I just discovered another problem with this script. In IE9, the parent page is printed along with the modal (the modal looks transparent), instead of just the modal. Can anyone look at the link below, and tell me why the infoWindow displays the same xml marker node for each marker Thanks Lee http://www.hotels.seotra.com/ I have a page with categories of images. When clicked, each image on the left opens a div with it's own gallery of thumbnails. http://myspringslandscaping.com/portfolio.html Right now, to close a div, the category image has to be clicked a second time. How can I set it so that when one div opens, the other closes automatically? The client wants only one category displayed at a time. Any help would be appreciated. Thanks! Marita |