2013-05-14 54 views
0

我已經從示例地圖中複製了html:https://developers.google.com/maps/documentation/javascript/examples/layer-kml。我簡單地複製代碼到文本編輯器並保存爲HTML和在IE和Firefox運行,但沒有地圖showed.Any建議,請在api教程中運行示例谷歌地圖

感謝 伊恩

+0

可能的重複[爲什麼谷歌地圖教程在我的電腦上工作?](http://stackoverflow.com/questions/11971379/why-doesnt-the-google-maps-tutorial-work-on-my- pc) – geocodezip 2013-05-14 15:04:58

回答

0

你需要這個文件還:

<link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet"> 

Google's sample on my server

或包含此在它的地方:

<style type="text/css"> 
html, body { 
    height: 100%; 
    margin: 0; 
    padding: 0; 
} 

#map-canvas, #map_canvas { 
    height: 100%; 
} 

@media print { 
    html, body { 
    height: auto; 
    } 

    #map_canvas { 
    height: 650px; 
    } 
} 

#panel { 
    position: absolute; 
    top: 5px; 
    left: 50%; 
    margin-left: -180px; 
    z-index: 5; 
    background-color: #fff; 
    padding: 5px; 
    border: 1px solid #999; 
} 
</style> 
+0

感謝您的回覆。 css鏈接已經在那裏。這是代碼: – user2382031 2013-05-14 14:34:37

+0

無法添加代碼,文件太長。這是鏈接:https://developers.google.com/maps/documentation/javascript/examples/layer-kml – user2382031 2013-05-14 14:35:40

+0

是您的代碼副本谷歌的服務器?你是否將css文件複製到_your_服務器(或本地計算機)上的同等位置?當我這樣做時,文檔中的示例對我來說很好(實際上,我通常只是用上面的樣式標籤替換鏈接)。順便說一句 - 請不要在評論中發佈代碼,最好是編輯你的問題來添加它(它應該已經在那裏了......)。 – geocodezip 2013-05-14 14:40:00