why the map doesn't appear

0 views
Skip to first unread message

xing yi

unread,
Nov 17, 2009, 2:02:05 AM11/17/09
to 谷歌地图 API 论坛
hi,

I write a program as google api,I apply the key ,and the url is
http://localhost,but the map still doesn't appear ,I want to know
why??
the code is :
<html>
<head>
<title>map test</title>
<script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;key=ABQIAAAAqMer9dEUo5UJ7jVVjBgvGRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTFlTq93Vaof72zB4FOGlMqmgBYDg"></
script>
<script type = "text/javascript">

//<![CDATA[
function load() {
if (GBrowserIsCompatible())
{
var map = null;
map = new Gmap2(document.getElementById("map"));
map.setCenter(new GLanlng(39.917, 116.397),13);
}
}

//]]>
</script>

</head>
<body onload = "load()" onunload = "GUnload()">
<div id = "map" style = "width: 300px; height: 500px"></div>
</body>
</html>

林志鹏

unread,
Nov 17, 2009, 2:20:34 AM11/17/09
to google-map...@googlegroups.com
There r some errors in this code segment  
The key is wrong。you can correct it like this:

<script src="http://ditu.google.cn/maps?file=api&amp;v=2&amp;key=abcdefg&sensor=true_or_false"
            type="text/javascript"></script>



/:~




2009/11/17 xing yi <6576...@qq.com>



--
谢谢!
____________
林志鹏
Email:  ssoo...@gmail.com
MSN:   ss...@hotmail.co.jp
QQ:     418481321

李白,字一日

unread,
Nov 20, 2009, 4:49:53 AM11/20/09
to google-map...@googlegroups.com
<!--
代码中存在下面几处错误。
1. script标签错误,没有指定language
2. GMap与GLatLng错误。

下面是修改过的代码:
-->

<html> 
        <head> 
                <title>map test</title> 
                <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAqMer9dEUo5UJ7jVVjBgvGRT2yXp_ZAY8_ufC3CFXhH IE1NvwkxTFlTq93Vaof72zB4FOGlMqmgBYDg"></script> 
                <script type = "text/javascript" language="javascript"> 
                //<![CDATA[ 
                        function load() { 
                                if (GBrowserIsCompatible()) 
                                { 
                                        var map = null; 
                                        map = new GMap2(document.getElementById("map")); 
                                        map.setCenter(new GLatLng(39.917, 116.397),13); 
                                } 
                        } 
                //]]> 
                </script> 
        </head> 
        <body onload = "load()" onunload = "GUnload()"> 
                        <div id = "map" style = "width: 300px; height: 500px"></div> 
        </body> 
</html>

2009/11/17 xing yi <6576...@qq.com>
Reply all
Reply to author
Forward
0 new messages