??S涓???浠ラ??杩?璁劇疆style.display????style.visibility灞??ф?ユ?у?跺??绱??????劇ず锛???tyle.display=block??style.visibility=visible???跺??锛???绱?琚??劇ず锛???tyle.display=none??style.visibility=hidden???跺??锛???绱?琚???????瀹?浠?涔??存??澶х???哄??????杩?style.display=none???????跺??锛???绱?涓????????ョ??浣?缃?锛?浠???妗f?涓??辯?锛???缁?????绱?濉?琛ュ?朵?缃?????杩?style.visibility=hidden???????跺??锛???绱?浠??跺???????ョ??浣?缃?锛?????琚???????
?
涓??㈢??渚?瀛?璇存??浜?杩?绉??哄??锛??ㄨ?涓?渚?瀛?涓?锛?divContent1??divContent2???????跺???ㄧ????style.display=none锛?杩??跺??锛????㈢??div浼???涓?绉誨???????宸茬???????div??绌洪?淬??divContent3??divContent4?ㄧ????style.visibility=hidden?ラ????锛?浣????堕??????浠??跺???????ョ??绌洪?淬??
?
[html]
<html>?
<head>?
<title>test</title>?
<meta http-equiv=content-type content="text/html; charset=gb2312">?
<style>?
.titlediv{background-color:#eee;color:white;font-weight:bold;padding:10px;cursor:pointer }?
.contentdiv{border:3px solid blue;height:100px;padding:10px; }?
</style>?
<script type="text/javascript">???
function toggle(divid){?
??? var odiv = document.getElementById(divid);?
??? odiv.style.display=(odiv.style.display=="none")?"block":"none";?
}?
?
function showhide(divid){?
??? var odiv = document.getElementById(divid);?
??? odiv.style.visibility=(odiv.style.visibility=="visible")?"hidden":"visible";?
}?
</script>?????
</head>???
<body >???
??? <div class="titlediv" 慰nclick="toggle('divContetn1')">click here</div>??
??? <div class="contentdiv" id="divContetn1">this is some content to show and hide?
??? </div>?
??? <p> </p>?
??? <div class="titlediv" 慰nclick="toggle('divContetn2')">click here</div>??
??? <div class="contentdiv" id="divContetn2">this is some content to show and hide?
??? </div>??
??? <p> </p>?
??? <div class="titlediv" 慰nclick="showhide('divContetn3')">click here</div>??
??? <div class="contentdiv" id="divContetn3">this is some content to show and hide?
??? </div>?
??? <p> </p>?
??? <div class="titlediv" 慰nclick="showhide('divContetn4')">click here</div>??
??? <div class="contentdiv" id="divContetn4">this is some content to show and hide?
??? </div>?????????
</body>???