Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18832 > unrolled thread

problem with google map when using IE 10

Started by"Tony" <tony.johansson@inport.com>
First post2013-03-11 08:36 +0100
Last post2013-03-11 13:25 +0100
Articles 7 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  problem with google map when using IE 10 "Tony" <tony.johansson@inport.com> - 2013-03-11 08:36 +0100
    Re: problem with google map when using IE 10 Andrew Poulos <ap_prog@hotmail.com> - 2013-03-11 19:33 +1100
      Re: problem with google map when using IE 10 "Tony" <tony.johansson@inport.com> - 2013-03-11 10:05 +0100
        Re: problem with google map when using IE 10 Andrew Poulos <ap_prog@hotmail.com> - 2013-03-11 20:27 +1100
          Re: problem with google map when using IE 10 "Tony" <tony.johansson@inport.com> - 2013-03-11 10:52 +0100
            Re: problem with google map when using IE 10 "Tony" <tony.johansson@inport.com> - 2013-03-11 12:37 +0100
              Re: problem with google map when using IE 10 "Tony" <tony.johansson@inport.com> - 2013-03-11 13:25 +0100

#18832 — problem with google map when using IE 10

From"Tony" <tony.johansson@inport.com>
Date2013-03-11 08:36 +0100
Subjectproblem with google map when using IE 10
Message-ID<khk1f5$h4q$1@dont-email.me>
This javascrip works fine when I use Firefox but when I switch to IE 10 I 
get error saying google has not been defined
How do I make it work in IE 10 ?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<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"/>
      <script type="text/javascript" 
src="http://www.google.com/jsapi"></script>
      <script type="text/javascript">
          google.load("maps", "2", { "other_params":"sensor=false" });

          function init()
          {
              map = new google.maps.Map2(document.getElementById("map"));
              var myLatLng = new google.maps.LatLng(58.135148, 12.122726, 
true);
              map.setCenter(myLatLng, 15);
              var myMarker = new google.maps.Marker(myLatLng, { "title": 
"Eken" });
              map.addControl(new google.maps.LargeMapControl());
              map.addControl(new google.maps.MapTypeControl());
              map.setMapType(G_SATELLITE_MAP);
              map.addOverlay(myMarker);
          };
          google.setOnLoadCallback(init);
      </script>
      <title>My first Google Map</title>
   </head>
   <body>
      <div id="map" style="width: 400px; height: 400px; margin: auto; 
background-color: red">
         This is where the map will soon appear.
      </div>
   </body>
</html>

//Tony 

[toc] | [next] | [standalone]


#18833

FromAndrew Poulos <ap_prog@hotmail.com>
Date2013-03-11 19:33 +1100
Message-ID<xZKdnVv8dttDC6DMnZ2dnUVZ_rCdnZ2d@westnet.com.au>
In reply to#18832
On 11/03/2013 6:36 PM, Tony wrote:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <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"/>
>       <script type="text/javascript"
> src="http://www.google.com/jsapi"></script>
>       <script type="text/javascript">
>           google.load("maps", "2", { "other_params":"sensor=false" });
>
>           function init()
>           {
>               map = new google.maps.Map2(document.getElementById("map"));
>               var myLatLng = new google.maps.LatLng(58.135148,
> 12.122726, true);
>               map.setCenter(myLatLng, 15);
>               var myMarker = new google.maps.Marker(myLatLng, { "title":
> "Eken" });
>               map.addControl(new google.maps.LargeMapControl());
>               map.addControl(new google.maps.MapTypeControl());
>               map.setMapType(G_SATELLITE_MAP);
>               map.addOverlay(myMarker);
>           };
>           google.setOnLoadCallback(init);
>       </script>
>       <title>My first Google Map</title>
>    </head>
>    <body>
>       <div id="map" style="width: 400px; height: 400px; margin: auto;
> background-color: red">
>          This is where the map will soon appear.
>       </div>
>    </body>
> </html>

Which line gives the error?

Andrew Poulos

[toc] | [prev] | [next] | [standalone]


#18835

From"Tony" <tony.johansson@inport.com>
Date2013-03-11 10:05 +0100
Message-ID<khk6la$6va$1@dont-email.me>
In reply to#18833
This line
   google.load("maps", "2", { "other_params":"sensor=false" });
cause in swedish
"Körningsfel i JavaScript: google har inte definierats"
and translated to english it it's
runtime error in Javascript google has not been defined

//Tony



"Andrew Poulos"  wrote in message 
news:xZKdnVv8dttDC6DMnZ2dnUVZ_rCdnZ2d@westnet.com.au...

On 11/03/2013 6:36 PM, Tony wrote:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <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"/>
>       <script type="text/javascript"
> src="http://www.google.com/jsapi"></script>
>       <script type="text/javascript">
>           google.load("maps", "2", { "other_params":"sensor=false" });
>
>           function init()
>           {
>               map = new google.maps.Map2(document.getElementById("map"));
>               var myLatLng = new google.maps.LatLng(58.135148,
> 12.122726, true);
>               map.setCenter(myLatLng, 15);
>               var myMarker = new google.maps.Marker(myLatLng, { "title":
> "Eken" });
>               map.addControl(new google.maps.LargeMapControl());
>               map.addControl(new google.maps.MapTypeControl());
>               map.setMapType(G_SATELLITE_MAP);
>               map.addOverlay(myMarker);
>           };
>           google.setOnLoadCallback(init);
>       </script>
>       <title>My first Google Map</title>
>    </head>
>    <body>
>       <div id="map" style="width: 400px; height: 400px; margin: auto;
> background-color: red">
>          This is where the map will soon appear.
>       </div>
>    </body>
> </html>

Which line gives the error?

Andrew Poulos 

[toc] | [prev] | [next] | [standalone]


#18836

FromAndrew Poulos <ap_prog@hotmail.com>
Date2013-03-11 20:27 +1100
Message-ID<kICdnVv6kYTtPqDMnZ2dnUVZ_uWdnZ2d@westnet.com.au>
In reply to#18835
On 11/03/2013 8:05 PM, Tony wrote:
> This line
>    google.load("maps", "2", { "other_params":"sensor=false" });
> cause in swedish
> "Körningsfel i JavaScript: google har inte definierats"
> and translated to english it it's
> runtime error in Javascript google has not been defined
>
> //Tony
>
>
>
> "Andrew Poulos"  wrote in message
> news:xZKdnVv8dttDC6DMnZ2dnUVZ_rCdnZ2d@westnet.com.au...
>
> On 11/03/2013 6:36 PM, Tony wrote:
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>> <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"/>
>>       <script type="text/javascript"
>> src="http://www.google.com/jsapi"></script>
>>       <script type="text/javascript">
>>           google.load("maps", "2", { "other_params":"sensor=false" });
>>
>>           function init()
>>           {
>>               map = new google.maps.Map2(document.getElementById("map"));
>>               var myLatLng = new google.maps.LatLng(58.135148,
>> 12.122726, true);
>>               map.setCenter(myLatLng, 15);
>>               var myMarker = new google.maps.Marker(myLatLng, { "title":
>> "Eken" });
>>               map.addControl(new google.maps.LargeMapControl());
>>               map.addControl(new google.maps.MapTypeControl());
>>               map.setMapType(G_SATELLITE_MAP);
>>               map.addOverlay(myMarker);
>>           };
>>           google.setOnLoadCallback(init);
>>       </script>
>>       <title>My first Google Map</title>
>>    </head>
>>    <body>
>>       <div id="map" style="width: 400px; height: 400px; margin: auto;
>> background-color: red">
>>          This is where the map will soon appear.
>>       </div>
>>    </body>
>> </html>
>
> Which line gives the error?

First, I would right my page as HTML 4 Strict, or HTML 5 (I think that 
XHTML is now moot).

Secondly, it looks like IE 10 (which I don't have) is running your code 
before its loaded whatever Google has at http://www.google.com/jsapi. 
You might need some sort of loop that checks for the existence of the 
Google objects or maybe wrapping your code in

window.onload = function() {
...
};

might help.

Andrew Poulos



[toc] | [prev] | [next] | [standalone]


#18837

From"Tony" <tony.johansson@inport.com>
Date2013-03-11 10:52 +0100
Message-ID<khk9dp$jnh$1@dont-email.me>
In reply to#18836
I changed the code but I stilll get google not defined on this line
  google.load("maps", "2", { "other_params": "sensor=false" });
I have google but no suggestion has helped so far.
Have you some more idea what I can do ?

<!DOCTYPE html>
<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"/>
      <script type="text/javascript" 
src="https://www.google.com/jsapi"></script>

      <script type="text/javascript">
          window.onload = function ()
          {
              google.load("maps", "2", { "other_params": "sensor=false" });

              init();
              // google.setOnLoadCallback(init);
          };


          function init()
          {
              map = new google.maps.Map2(document.getElementById("map"));
              var myLatLng = new google.maps.LatLng(58.135148, 12.122726, 
true);
              map.setCenter(myLatLng, 15);
              var myMarker = new google.maps.Marker(myLatLng, { "title": 
"Eken" });
              map.addControl(new google.maps.LargeMapControl());
              map.addControl(new google.maps.MapTypeControl());
              map.setMapType(G_SATELLITE_MAP);
              map.addOverlay(myMarker);
          };

      </script>
      <title>My first Google Map</title>
   </head>
   <body>
      <div id="map" style="width: 400px; height: 400px; margin: auto; 
background-color: red">
         This is where the map will soon appear.
      </div>
   </body>
</html>

//Tony

"Andrew Poulos"  wrote in message 
news:kICdnVv6kYTtPqDMnZ2dnUVZ_uWdnZ2d@westnet.com.au...

On 11/03/2013 8:05 PM, Tony wrote:
> This line
>    google.load("maps", "2", { "other_params":"sensor=false" });
> cause in swedish
> "Körningsfel i JavaScript: google har inte definierats"
> and translated to english it it's
> runtime error in Javascript google has not been defined
>
> //Tony
>
>
>
> "Andrew Poulos"  wrote in message
> news:xZKdnVv8dttDC6DMnZ2dnUVZ_rCdnZ2d@westnet.com.au...
>
> On 11/03/2013 6:36 PM, Tony wrote:
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>> <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"/>
>>       <script type="text/javascript"
>> src="http://www.google.com/jsapi"></script>
>>       <script type="text/javascript">
>>           google.load("maps", "2", { "other_params":"sensor=false" });
>>
>>           function init()
>>           {
>>               map = new google.maps.Map2(document.getElementById("map"));
>>               var myLatLng = new google.maps.LatLng(58.135148,
>> 12.122726, true);
>>               map.setCenter(myLatLng, 15);
>>               var myMarker = new google.maps.Marker(myLatLng, { "title":
>> "Eken" });
>>               map.addControl(new google.maps.LargeMapControl());
>>               map.addControl(new google.maps.MapTypeControl());
>>               map.setMapType(G_SATELLITE_MAP);
>>               map.addOverlay(myMarker);
>>           };
>>           google.setOnLoadCallback(init);
>>       </script>
>>       <title>My first Google Map</title>
>>    </head>
>>    <body>
>>       <div id="map" style="width: 400px; height: 400px; margin: auto;
>> background-color: red">
>>          This is where the map will soon appear.
>>       </div>
>>    </body>
>> </html>
>
> Which line gives the error?

First, I would right my page as HTML 4 Strict, or HTML 5 (I think that
XHTML is now moot).

Secondly, it looks like IE 10 (which I don't have) is running your code
before its loaded whatever Google has at http://www.google.com/jsapi.
You might need some sort of loop that checks for the existence of the
Google objects or maybe wrapping your code in

window.onload = function() {
...
};

might help.

Andrew Poulos


[toc] | [prev] | [next] | [standalone]


#18839

From"Tony" <tony.johansson@inport.com>
Date2013-03-11 12:37 +0100
Message-ID<khkfip$go3$1@dont-email.me>
In reply to#18837
I have now change  a bit and now I have come a bit longer
The code looks like this and the alert is saying google map is loaded so I 
now the the loader has loaded the google.map.
Now I get an error on this line
  map = new google.maps.Map2(document.getElementById("map"));
and the error is in swedish
Körningsfel i JavaScript: Objektet kan inte hantera denna åtgärd.
and translated to english it is
runtime error in JavaScript: Object can not handle this action

Is it anyone that have any idea how to fix it ?
Note the exact same code work fine in Firefox.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:v="urn:schemas-microsoft-com:vml">
   <head>
      <title>Google Maps and jQuery</title>
      <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
      <script type="text/javascript" 
src="https://www.google.com/jsapi"></script>
      <link href="../JavaScript/jquery/themes/base/jquery-ui.css" 
type="text/css" rel="stylesheet"  media="all" />
      <script src="../JavaScript/jquery/jquery.js" type="text/javascript" />
      <script src="../JavaScript/jquery/jquery.cookie.js" 
type="text/javascript" />
      <script src="../JavaScript/jquery/ui/jquery-ui.js" 
type="text/javascript"></script>


      <script type="text/javascript">

          google.load("maps", "2", { "other_params": "sensor=false" });

          if (google && google.maps)
          {
             alert("google map is loaded");
          }

          function init()
          {
              map = new google.maps.Map2(document.getElementById("map"));
              var myLatLng = new google.maps.LatLng(58.135148, 12.122726, 
true);
              map.setCenter(myLatLng, 15);
              var myMarker = new google.maps.Marker(myLatLng, { "title": 
"Eken" });
              map.addControl(new google.maps.LargeMapControl());
              map.addControl(new google.maps.MapTypeControl());
              map.setMapType(G_SATELLITE_MAP);
              map.addOverlay(myMarker);
          };
          google.setOnLoadCallback(init);
      </script>
   </head>
   <body>
      <div id="map" style="width: 400px; height: 400px; margin: auto; 
background-color: red">
         This is where the map will soon appear.
      </div>
   </body>
</html>


"Tony"  wrote in message news:khk9dp$jnh$1@dont-email.me...

I changed the code but I stilll get google not defined on this line
  google.load("maps", "2", { "other_params": "sensor=false" });
I have google but no suggestion has helped so far.
Have you some more idea what I can do ?

<!DOCTYPE html>
<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"/>
      <script type="text/javascript"
src="https://www.google.com/jsapi"></script>

      <script type="text/javascript">
          window.onload = function ()
          {
              google.load("maps", "2", { "other_params": "sensor=false" });

              init();
              // google.setOnLoadCallback(init);
          };


          function init()
          {
              map = new google.maps.Map2(document.getElementById("map"));
              var myLatLng = new google.maps.LatLng(58.135148, 12.122726,
true);
              map.setCenter(myLatLng, 15);
              var myMarker = new google.maps.Marker(myLatLng, { "title":
"Eken" });
              map.addControl(new google.maps.LargeMapControl());
              map.addControl(new google.maps.MapTypeControl());
              map.setMapType(G_SATELLITE_MAP);
              map.addOverlay(myMarker);
          };

      </script>
      <title>My first Google Map</title>
   </head>
   <body>
      <div id="map" style="width: 400px; height: 400px; margin: auto;
background-color: red">
         This is where the map will soon appear.
      </div>
   </body>
</html>

//Tony

"Andrew Poulos"  wrote in message
news:kICdnVv6kYTtPqDMnZ2dnUVZ_uWdnZ2d@westnet.com.au...

On 11/03/2013 8:05 PM, Tony wrote:
> This line
>    google.load("maps", "2", { "other_params":"sensor=false" });
> cause in swedish
> "Körningsfel i JavaScript: google har inte definierats"
> and translated to english it it's
> runtime error in Javascript google has not been defined
>
> //Tony
>
>
>
> "Andrew Poulos"  wrote in message
> news:xZKdnVv8dttDC6DMnZ2dnUVZ_rCdnZ2d@westnet.com.au...
>
> On 11/03/2013 6:36 PM, Tony wrote:
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>> <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"/>
>>       <script type="text/javascript"
>> src="http://www.google.com/jsapi"></script>
>>       <script type="text/javascript">
>>           google.load("maps", "2", { "other_params":"sensor=false" });
>>
>>           function init()
>>           {
>>               map = new google.maps.Map2(document.getElementById("map"));
>>               var myLatLng = new google.maps.LatLng(58.135148,
>> 12.122726, true);
>>               map.setCenter(myLatLng, 15);
>>               var myMarker = new google.maps.Marker(myLatLng, { "title":
>> "Eken" });
>>               map.addControl(new google.maps.LargeMapControl());
>>               map.addControl(new google.maps.MapTypeControl());
>>               map.setMapType(G_SATELLITE_MAP);
>>               map.addOverlay(myMarker);
>>           };
>>           google.setOnLoadCallback(init);
>>       </script>
>>       <title>My first Google Map</title>
>>    </head>
>>    <body>
>>       <div id="map" style="width: 400px; height: 400px; margin: auto;
>> background-color: red">
>>          This is where the map will soon appear.
>>       </div>
>>    </body>
>> </html>
>
> Which line gives the error?

First, I would right my page as HTML 4 Strict, or HTML 5 (I think that
XHTML is now moot).

Secondly, it looks like IE 10 (which I don't have) is running your code
before its loaded whatever Google has at http://www.google.com/jsapi.
You might need some sort of loop that checks for the existence of the
Google objects or maybe wrapping your code in

window.onload = function() {
...
};

might help.

Andrew Poulos

[toc] | [prev] | [next] | [standalone]


#18840

From"Tony" <tony.johansson@inport.com>
Date2013-03-11 13:25 +0100
Message-ID<khkidi$utl$1@dont-email.me>
In reply to#18839
It works now in IE 10

//Tony

"Tony"  wrote in message news:khkfip$go3$1@dont-email.me...

I have now change  a bit and now I have come a bit longer
The code looks like this and the alert is saying google map is loaded so I
now the the loader has loaded the google.map.
Now I get an error on this line
  map = new google.maps.Map2(document.getElementById("map"));
and the error is in swedish
Körningsfel i JavaScript: Objektet kan inte hantera denna åtgärd.
and translated to english it is
runtime error in JavaScript: Object can not handle this action

Is it anyone that have any idea how to fix it ?
Note the exact same code work fine in Firefox.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml">
   <head>
      <title>Google Maps and jQuery</title>
      <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
      <script type="text/javascript"
src="https://www.google.com/jsapi"></script>
      <link href="../JavaScript/jquery/themes/base/jquery-ui.css"
type="text/css" rel="stylesheet"  media="all" />
      <script src="../JavaScript/jquery/jquery.js" type="text/javascript" />
      <script src="../JavaScript/jquery/jquery.cookie.js"
type="text/javascript" />
      <script src="../JavaScript/jquery/ui/jquery-ui.js"
type="text/javascript"></script>


      <script type="text/javascript">

          google.load("maps", "2", { "other_params": "sensor=false" });

          if (google && google.maps)
          {
             alert("google map is loaded");
          }

          function init()
          {
              map = new google.maps.Map2(document.getElementById("map"));
              var myLatLng = new google.maps.LatLng(58.135148, 12.122726,
true);
              map.setCenter(myLatLng, 15);
              var myMarker = new google.maps.Marker(myLatLng, { "title":
"Eken" });
              map.addControl(new google.maps.LargeMapControl());
              map.addControl(new google.maps.MapTypeControl());
              map.setMapType(G_SATELLITE_MAP);
              map.addOverlay(myMarker);
          };
          google.setOnLoadCallback(init);
      </script>
   </head>
   <body>
      <div id="map" style="width: 400px; height: 400px; margin: auto;
background-color: red">
         This is where the map will soon appear.
      </div>
   </body>
</html>


"Tony"  wrote in message news:khk9dp$jnh$1@dont-email.me...

I changed the code but I stilll get google not defined on this line
  google.load("maps", "2", { "other_params": "sensor=false" });
I have google but no suggestion has helped so far.
Have you some more idea what I can do ?

<!DOCTYPE html>
<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"/>
      <script type="text/javascript"
src="https://www.google.com/jsapi"></script>

      <script type="text/javascript">
          window.onload = function ()
          {
              google.load("maps", "2", { "other_params": "sensor=false" });

              init();
              // google.setOnLoadCallback(init);
          };


          function init()
          {
              map = new google.maps.Map2(document.getElementById("map"));
              var myLatLng = new google.maps.LatLng(58.135148, 12.122726,
true);
              map.setCenter(myLatLng, 15);
              var myMarker = new google.maps.Marker(myLatLng, { "title":
"Eken" });
              map.addControl(new google.maps.LargeMapControl());
              map.addControl(new google.maps.MapTypeControl());
              map.setMapType(G_SATELLITE_MAP);
              map.addOverlay(myMarker);
          };

      </script>
      <title>My first Google Map</title>
   </head>
   <body>
      <div id="map" style="width: 400px; height: 400px; margin: auto;
background-color: red">
         This is where the map will soon appear.
      </div>
   </body>
</html>

//Tony

"Andrew Poulos"  wrote in message
news:kICdnVv6kYTtPqDMnZ2dnUVZ_uWdnZ2d@westnet.com.au...

On 11/03/2013 8:05 PM, Tony wrote:
> This line
>    google.load("maps", "2", { "other_params":"sensor=false" });
> cause in swedish
> "Körningsfel i JavaScript: google har inte definierats"
> and translated to english it it's
> runtime error in Javascript google has not been defined
>
> //Tony
>
>
>
> "Andrew Poulos"  wrote in message
> news:xZKdnVv8dttDC6DMnZ2dnUVZ_rCdnZ2d@westnet.com.au...
>
> On 11/03/2013 6:36 PM, Tony wrote:
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>> <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"/>
>>       <script type="text/javascript"
>> src="http://www.google.com/jsapi"></script>
>>       <script type="text/javascript">
>>           google.load("maps", "2", { "other_params":"sensor=false" });
>>
>>           function init()
>>           {
>>               map = new google.maps.Map2(document.getElementById("map"));
>>               var myLatLng = new google.maps.LatLng(58.135148,
>> 12.122726, true);
>>               map.setCenter(myLatLng, 15);
>>               var myMarker = new google.maps.Marker(myLatLng, { "title":
>> "Eken" });
>>               map.addControl(new google.maps.LargeMapControl());
>>               map.addControl(new google.maps.MapTypeControl());
>>               map.setMapType(G_SATELLITE_MAP);
>>               map.addOverlay(myMarker);
>>           };
>>           google.setOnLoadCallback(init);
>>       </script>
>>       <title>My first Google Map</title>
>>    </head>
>>    <body>
>>       <div id="map" style="width: 400px; height: 400px; margin: auto;
>> background-color: red">
>>          This is where the map will soon appear.
>>       </div>
>>    </body>
>> </html>
>
> Which line gives the error?

First, I would right my page as HTML 4 Strict, or HTML 5 (I think that
XHTML is now moot).

Secondly, it looks like IE 10 (which I don't have) is running your code
before its loaded whatever Google has at http://www.google.com/jsapi.
You might need some sort of loop that checks for the existence of the
Google objects or maybe wrapping your code in

window.onload = function() {
...
};

might help.

Andrew Poulos

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web