如何在2个iframe之间切换?

时间:2016-04-28 17:40:54

标签: javascript html css iframe

我一直在尝试这么多不同的代码,但我似乎无法使用我的iframe。我不能使用jquery所以我正在寻找一个javascript / css答案

我希望用户将map1视为默认值并单击map2,以查看map2并隐藏map1。

<a href="javascript:toggle('map1')" ><b>map1</b></a>               
<a href="javascript:toggle('map2')" ><b>map2</b></a>

<div id="map1">
    <div class="embed-container">
    <iframe class="crime-rate-wards" width="500" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" title="crime" 
    src="http://birkbeck.maps.arcgis.com/apps/Embed/index.html?webmap=8a4e79b3c8584a75bda00b262d84263f&amp;
    extent=-0.5836,51.3506,0.4252,51.6629&amp;home=true&amp;zoom=true&amp;scale=true&amp;legend=true&amp;disable_scroll=true&amp;theme=light">
    </iframe>
</div>      
</div>
<div id="map2" style="display:none;">
    <div class="embed-container">
    <iframe class="crime-rate-borough" width="500" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" title="crime2" 
    src="http://birkbeck.maps.arcgis.com/apps/Embed/index.html?webmap=e96ac6e24dc94b919945e7c95be2ee95&amp;
    extent=-0.5836,51.3506,0.4252,51.6629&amp;home=true&amp;zoom=true&amp;legend=true&amp;disable_scroll=true&amp;theme=light">
    </iframe>
</div>  
</div>

这是jfiddle http://jsfiddle.net/Luffydude/PPhqQ/36/

0 个答案:

没有答案