2015-04-22 106 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,得到查询字符串值和使用它在需要的地方。