今天使用Google Maps JavaScript API,將Google地圖嵌入網頁,使用「iframe」語法, 稱為內置框架或內聯框架,常用來在網頁內嵌入另外一個網頁。 < iframe id = "demo" src = " http://maps.google.com.tw/maps?f=q&hl=zh-TW&geocode=&q=經緯度座標或地址&z=比例& t=h衛星圖或p地形圖&output=embed " width = "600" height = "450" frameborder = "0" style = " border:0; " allowfullscreen = "" aria-hidden = "false" tabindex = "0" > </ iframe > 也實作了地圖切換功能, 我們將 google map 網址中經緯度的部分改成變數,就可以切換好幾個不同的地圖 < a href = "javascript:f('24.121308,120.677175');" > 中興大學 </ a > < a href = "javascript:f('24.1371547,120.6865921');" > 台中火車站 </ a > 改變參數使用 getElementbyId 抓住網址,再搭配 js 當中的 setAttribute。 < script > function f ( loc ) { var str = 'http://maps.google.com.tw/maps?f=q&hl=zh-TW&geocode=...