2015-04-22 103 views
0

這是我想要實現的:JVectorMap:按鈕點擊更改地圖

我在index.html有三個按鈕。當我點擊它們時,我需要在另一個文件map.html中更改jvectormap。 js代碼在另一個文件中,map.js


如果我點擊:

<button type="button" id="world">World Map</button> 
<button type="button" id="Europe">Europe Map</button> 

應該改變map屬性值要麼world_mill_eneu_mill_en

map = new jvm.Map({ 
    map: 'world_mill_en', 
}) 

是否有可能做到這一點?我無法找到答案或找出答案。感謝您的幫助

回答

0

您可以從一個HTML頁面的查詢字符串傳遞到另一個。對於EG

index.html中

<button type="button" id="world" onclick="window.location.href='map.html?map=world_mill_en'">World Map</button> 

在map.html,得到查詢字符串值和使用它在需要的地方。