JS控制两个按钮交叉显示
1 <script> 2 function a(){ 3 var a = document.getElementById('a'); 4 var b = document.getElementById('b'); 5 if(b.style.display!='none'){ 6 b.style.display='none' 7 a.style.display='block' 8 }else if(a.style.display!='none'){ 9 a.style.display='none' 10 b.style.display='block' 11 } 12 } 13 </script> 14 <input type='button' id='a' value='A' οnclick='a()'> 15 <input type='button' id='b' value='B' οnclick='a()'>