1. 程式人生 > >點擊同一處顯示與隱藏

點擊同一處顯示與隱藏

bsp cli strong play 隱藏 post nbsp 顯示與隱藏 document

HTML

<a href="javascript:void()" onclick="show()">點擊此處顯示或隱藏</a>
<div id="hoary" style="display:none">可以隱身可以顯示。</div>

JS

<script type="text/javascript">
function show(){
document.getElementById("hoary").style.display=document.getElementById("hoary").style.display==‘‘?‘none‘:‘‘;
}
</script>

點擊同一處顯示與隱藏