Hello, I want to start off that I am not a programmer...more of a hack
I have been struggling with this for a long time and cannot find a solution. I created a PHP webpage that pulls gps data from a database and plots it to a map. The database logs coordinates for a number of police cars that we dispatch for. The page works fine on IE6, some IE7 and FF3.5, but not on certain IE7 and all IE8. I have tried clearing cache with no luck. Its not possible to open it up right now, because of the information it holds. Below if what I have (stripped out server IP,username and password. Any help woudl be appreciated. Thanks Scott Klein <html> <head> <title>DU-COMM Live GPS Vehicle Data</title> <script src="http://maps.google.com/maps? file=api&v=2.s&key=XXXXXXXXXXXXX" type="text/javascript"></script> </head> <body> <body onunload="GUnload()"> <p> <font size="4" face="Helvetica"> <u>Bartlett Police Vehicle Locations</u> </font> <BR> <BR> <font size="2" face="courier new"> Click on the Vehicle ID or a marker to get additional information. </font> </p> <!-- you can use tables or divs for the overall layout --> <table border=5> <tr> <td width = 188 valign="top" > <font size="4" face="Helvetica"> <u>Call Sign</u> <BR> <BR> </font> <div id="side_bar"></div> </font> </td> <td> <div id="map" style="width:800px; height: 600px"></div> </td> </tr> </table> <script type="text/javascript"> //<![CDATA[ // this variable will collect the html which will eventualkly be placed in the side_bar var side_bar_html = ""; // arrays to hold copies of the markers and html used by the side_bar // because the function closure trick doesnt work there var gmarkers = []; // Creates a marker whose info window displays the given number function createMarker(point, VehicleID, CallSign, AssignedIncident, UnitStatus, DateTime) { // use a custom icon with letter A - Z var letter = String.fromCharCode("A".charCodeAt(0) + (gmarkers.length)); var myIcon = new GIcon(G_DEFAULT_ICON, "http://www.google.com/mapfiles/ marker" + letter + ".png"); myIcon.printImage = "http://maps.google.com/mapfiles/marker"+letter +"ie.gif" myIcon.mozPrintImage = "http://maps.google.com/mapfiles/marker"+letter +"ff.gif" var CallSign = CallSign; var marker = new GMarker(point, {icon:myIcon}); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml('<font size="2" face="courier new">Call Sign: ' + CallSign + '<BR>Vehicle ID: ' + VehicleID + '<br>Event ID: ' + AssignedIncident + '<BR>Unit Status: ' + UnitStatus + '<br>Last Contact: ' + DateTime + '</font>');}); // save the info we need to use later for the side_bar gmarkers.push(marker) // add a line to the side_bar html side_bar_html += '<font size="3" face="courier new"><b>'+letter+'<\/b> - <a href="javascript:myclick(' + (gmarkers.length-1) + ')"> ' + CallSign + '<\/a></font><br>'; return marker; } // This function picks up the click and opens the corresponding info window function myclick(i) { GEvent.trigger(gmarkers[i], "click"); } // This function creates tha map var map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.addControl(new GScaleControl()); map.addControl(new GOverviewMapControl()); map.setCenter(new GLatLng(41.994376,-88.207254), 13, G_NORMAL_MAP); <?php // Server in the this format: <computer>\<instance name> or // <server>,<port> when using a non default port number $virtual_dsn = 'DRIVER={SQL Server};SERVER=xxx.xxx.xxx.xxx;DATABASE=Server'; $connection = odbc_connect($virtual_dsn,'username','password') or die ('ODBC Error:: '.odbc_error().' :: '.odbc_errormsg().' :: '. $virtual_dsn); $result = odbc_exec($connection, "SELECT top 26 t.DateTimeStamp, t.VehicleID, t.CallSign, t.UnitStatus, t.Latitude, t.Longitude, t.Heading, t.Speed,t.AssignedIncident FROM AVL t INNER JOIN LastReport l ON t.VehicleID = l.VehicleID AND t.DateTimeStamp = l.LastReport where t.VehicleID like 'BA%' and t.latitude < > '0' and t.CallSign < > 'Not In Service' ORDER BY t.VehicleID"); while($row = odbc_fetch_array($result)) { echo "var point = new GLatLng(" . $row['Latitude'] . "," . $row ['Longitude'] . ");\n"; echo "var marker = createMarker(point, '" . addslashes($row ['VehicleID']) . "', '" . addslashes($row['CallSign']) . "', '" . addslashes($row['UnitStatus']) . "', '" . addslashes($row ['AssignedIncident']) . "', '" . addslashes($row['DateTimeStamp']) . "');\n"; echo "map.addOverlay(marker);\n"; echo "\n"; } odbc_close ($connection); ?> // put the assembled side_bar_html contents into the side_bar div document.getElementById("side_bar").innerHTML = side_bar_html; //]]> </script> </body> </html> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en -~----------~----~----~----~------~----~------~--~---
