0 Replies - 5339 Views - Last Post: 31 January 2011 - 03:07 AM Rate Topic: -----

#1 lazy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 31-January 11

Google map Javascript not working in FireFox but working in IE

Posted 31 January 2011 - 03:07 AM

This code is working properly in IE 7. The ICons are displayed on the Google Map. But when I run this code on FireFox the Icons are not visible in Google Map, only the Google Map Is Displayed. Please Help Me!



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Icons.aspx.cs" Inherits="Icons" %>

<!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 runat="server">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7; IE=8;FF" />
<meta http-equiv=" X-UA-Compatible" content="IE=EmulateIE7" />
<title></title>
<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAJr_5LHsbDI6HhOXfh1gXwhTzk0Cc9ifI_L9pOLWjbOEz4Cv2HhTy-wJGhOOLSD_sGgU68k9gX28AdA"
type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div id="map" style="width: 550px; height: 450px;">
</div>
</form>
<script type="text/javascript">
function xyz()
{
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
else // Internet Explorer 5/6
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("Get", "Bins.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
xmlDoc.load("Bins.xml");
x = xmlDoc.getElementsByTagName("Current_Location");
var j = 0;
while (x.length > j)
{
z = x[j].getElementsByTagName("Vehicle_Name")[0].childNodes[0].nodeValue;
y = x[j].getElementsByTagName("Latitudes")[0].childNodes[0].nodeValue;
c = x[j].getElementsByTagName("Longitudes")[0].childNodes[0].nodeValue;
s = x[j].getElementsByTagName("Speed")[0].childNodes[0].nodeValue;
j++;
var point1 = new GLatLng(y, c);
var marker = createMarker(point1, '<div style="width:240px"> Some stuff to display in the First <p>Info <p>window. With a <a href="http://www.econym.demon.co.uk">Link<\/a> to my home page<\/div>', 7)
map.addOverlay(marker);
}
}
//<![CDATA[
if (GBrowserIsCompatible())
{
function createMarker(point, html, SpriteNum)
{
var myicon = new GIcon(G_DEFAULT_ICON);
myicon.image = Server.MapPath("Image/red1.jpg");
var marker = new GMarker(point, { icon: myicon });
GEvent.addListener(marker, "click", function () {
marker.openInfoWindowHtml(html);
});
return marker;
}
// Display the map, with some controls and set the initial location
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(28.6495, 77.2182), 8);
map.addControl(new GMapTypeControl());
map.addControl(new GLargeMapControl());
xyz();
}
//]]>
</script>
</body>
</html>

This post has been edited by lazy: 31 January 2011 - 03:11 AM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1