简单的div显示,隐藏例子

<script type=”text/javascript” language=”JavaScript”><!–
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = “none”;
}
function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = “block”;
}
function ReverseContentDisplay0(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == “none”) { document.getElementById(d).style.display = “block”; }
else { document.getElementById(d).style.display = “none”; }
}

function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
for(i=1;i<=3;i++){
var tmp = ‘block’+i;
if(d==tmp){
if(document.getElementById(d).style.display == “none”) { document.getElementById(d).style.display = “block”; }
else { document.getElementById(d).style.display = “none”; }
}else{
document.getElementById(tmp).style.display = “none”;
}
}
}
//–></script>

<a
onclick=”javascript:ReverseContentDisplay(‘block1’); return true;”
href=”#”>
[Bid 1]
</a>
<div
id=”block1″
style=”display:none;
border-style: solid;
background-color: white;
padding: 5px;”>

bLOCK 1
</div>
<br>
<a
onclick=”javascript:ReverseContentDisplay(‘block2’); return true;”
href=”#”>
[Bid 2]
</a>
<div
id=”block2″
style=”display:none;
border-style: solid;
background-color: white;
padding: 5px;”>

bLOCK 2
</div>
<br>
<a
onclick=”javascript:ReverseContentDisplay(‘block3’); return true;”
href=”#”>
[Bid 3]
</a>
<div
id=”block3″
style=”display:none;
border-style: solid;
background-color: white;
padding: 5px;”>

bLOCK 3
</div>

Comments are closed.