<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> </head> <body style="margin:50px 0;"> <div style="float:left; margin:0 auto; width:800px; padding-left:40px; line-height:25px;" >
<ul>
<li>
<a href="javascript:showDiv('id2');">显示id1的内容</a>
</li>
<li>
<a href="javascript:showDiv('id1');">显示id2的内容</a>
</li>
<li>
<a href="javascript:showDiv('id3');">显示id3的内容</a>
</li>
</ul>
</div> <div id="id1" align="center" style="display:" >
1111111111111111<a href="javascript:showDiv('id2');">我是id1内容的a链接,点击可回到id2的内容---显示id2内容</a>
</div> <div id="id2" align="center" style="display:none" >
222222222222222222222<a href="javascript:showDiv('id1');">我是id2内容的a链接,点击可回到id1的内容---显示id1内容</a>
</div> <div id="id" align="center" style="display:none" >
333333333333333333我是id3内容
</div>
<script language="javascript">
function showDiv(objId){
var objDiv=document.getElementById(objId);
var objDiv1=document.getElementById("id1");
var objDiv2=document.getElementById("id2");
var objDiv3=document.getElementById("id3");
objDiv1.style.display="none";
objDiv2.style.display="none";
objDiv3.style.display="none";
objDiv.style.display="";
}
</script>
</body>
</html>
05-06 04:05