想通过单选钮实现页面的切换,下面的内容不同,这个怎么实现
设一个单击事件,在javascript里写个函数,当单击时调用,将你所需要隐藏的div的属性设置成隐藏,剩下的不用说了吧。。。
以前用一个复选框没问题,实现了,现在用两个单选钮,实现不了
<script language="JavaScript">function show(i){var ui=document.getElementByld(i);if (i.style.display == "none") { i.style.display = ""; }else{ i.style.display = "none"; }} </script>
以前用一个复选框没问题,实现了,现在用两个单选钮,实现不了
<script language="JavaScript">function show(i){var ui=document.getElementByld(i);if (i.style.display == "none") { i.style.display = ""; }else{ i.style.display = "none"; }} </script>
如此就可解决
<script language="JavaScript">function show(){var tc1=document.getElementById("tc01");var tc2=document.getElementById("tc02");var tc3=document.getElementById("tc03");var tc4=document.getElementById("tc04");var dd1=document.getElementById("dd01");var dd2=document.getElementById("dd02");var dd3=document.getElementById("dd03");var dd4=document.getElementById("dd04");tc1.style.display='none';tc2.style.display='none';tc3.style.display='none';tc4.style.display='none';dd1.style.display='';dd2.style.display='';dd3.style.display='';dd4.style.display='';}function taocan(){var tc1=document.getElementById("tc01");var tc2=document.getElementById("tc02");var tc3=document.getElementById("tc03");var tc4=document.getElementById("tc04");var dd1=document.getElementById("dd01");var dd2=document.getElementById("dd02");var dd3=document.getElementById("dd03");var dd4=document.getElementById("dd04");tc1.style.display='';tc2.style.display='';tc3.style.display='';tc4.style.display='';dd1.style.display='none';dd2.style.display='none';dd3.style.display='none';dd4.style.display='none';} </script>
你用开关符号试试吧,
或者用按钮试试