Click here to Skip to main content
15,914,820 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm facing a problem while running any javascript code(having Google Map API) on many browsers like "Mozilla Firefox,Google chrome and IE". Before windows installation all code has been running well for months( during this period I have installed OS many times but no such issue happened). Even now they are running well on my friend's PC. Even Script debugger is not showing any error.
On the left bottom of browser window "Done" is showing means no error. I have done settings on IE in the Tools>Internet Options>Security & Advanced but still problem exists. As this setting is required for "ActiveX object" while reading the excel. I used this setting when I was running the code having ActiveX object. Main problem is that even the sample codes like "Map API" is also not running in no one browser as this code doesn't require any setting. For instance the following code is for plotting 10 markers on Map, I tried it but no response. I can't understand what the actual problem is.
Here is my code:

XML
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps API Sample</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8m ADN a0YKuWNNa8VNxQEerTAUcfkyrr6OwBovxn7TDAH5Q" type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(37.4419, -122.1419), 13);
    // Add 10 markers to the map at random locations
    var bounds = map.getBounds();
    var southWest = bounds.getSouthWest();
    var northEast = bounds.getNorthEast();
    var lngSpan = northEast.lng() - southWest.lng();
    var latSpan = northEast.lat() - southWest.lat();
    for (var i = 0; i < 10; i++) {
      var point = new GLatLng(southWest.lat() + latSpan * Math.random(),
                              southWest.lng() + lngSpan * Math.random());
      map.addOverlay(new GMarker(point));
    }
  }
}
</script>
</head>
<body onload="initialize()" unload="GUnload()" style="font-family: Arial;border: 0 none;">
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</body>
</html>
Posted
Updated 18-Nov-10 18:22pm
v2
Comments
Sandeep Mewara 19-Nov-10 1:08am    
Getting some error must have helped. Your issue does not sound normal and it would be difficult to point the reason.

It has nothing to do with ActiveX since ther is no ActiveX installed.

Have you debugged this script? Does any JavaScript run, not just this? Have you checked if JavaScript is enabled in the browsers?
 
Share this answer
 
Yes there is no settings required for the above code but main problem is that the programs whose output is just to show text on browser is running well means JavaScript is enabled but the codes for Maps is not running.Even the above code is simple code from Map API reference.
Yes i have script debugger but on left bottom of browser window "done" is showing.If there is an error so it must show warning.Cofusing thing is that the code is running well on my friend's pc.
Can anyone help me plz
 
Share this answer
 
Comments
[no name] 19-Nov-10 17:04pm    
"Yes i have script debugger..." but have you USED IT! Have you stepped through the code and anzlyzed the variables and methods being called?
Farah Siraj 19-Nov-10 21:13pm    
Yes after running the code i set script debugger to "break at next statement" but error is showing "done is showing on left bottom of browser ,even i can't understand that the same code is running on my friend's pc because its an Map API

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900