我无法使用AJAX(服务器问题!),所以我不得不依靠DOM + javascript在我的页面上显示或隐藏两个div。DOM(Javascript)show/hide divs not working
用户单击两个单选按钮中的一个,并根据哪个单击,显示相应的div。
由于某些原因,如果使用“EU”单选按钮但第一个div会加载,但无法使用“国际”单选按钮来工作。第二个按钮调用正确的脚本,传递变量甚至隐藏EU div,它不会显示国际版本。
我在我的智慧结束。任何人都可以帮忙吗?
使用Javascript:
function displayLocation(loc){
alert(loc)
document.getElementById(loc).style.display = "block"
if (loc == "eu"){
document.getElementById("international").style.display = "none"
}else{
document.getElementById("eu").style.display = "none"
}
}
HTML单选按钮
<input type="radio" name="loc" style="float:left;" onclick=displayLocation("eu")>
<input type="radio" name="loc" style="float:left;" onclick=displayLocation("international")>
Div的隐藏/显示适当
<div id="eu" style="display:none;">European Union</div>
<div id="international" style="display:none;">International</div>
我”已经做了这些变化,并没有好的测试 – useyourillusiontoo 2013-03-05 14:24:39