这个行不?
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
var time;
function toggle(sDivId)
{
var oDiv=document.getElementById(sDivId);

oDiv.style.display=oDiv.style.display=="none"?"block":"none";
} function onload()
{
var arr=document.getElementsByTagName("div"); for (var i=0;i<arr.length ;i++ )
{
arr[i].style.left="0px";
arr[i].style.width=document.body.offsetWidth/3;
}
}
</script></head>
<body>
<table width="20%">
<tr>
<td>
<div style="background-color:blue;color:white;font-weight:bold;padding:10px;cursor:pointer" onclick="toggle('divContent1')">基本设置</div> <div style="border:3px solid blue;height:100px;padding:10px" id="divContent1">This is some content to show and hide</div>
</td>
</tr> <tr>
<td>
<div style="background-color:blue;color:white;font-weight:bold;padding:10px;cursor:pointer" onclick="toggle('divContent2')">新闻管理</div> <div style="border:3px solid blue;height:100px;padding:10px" id="divContent2">This is some content to show and hide<br>This is some content to show and hide<br>This is some content to show and hide<br>This is some content to show and hide<br></div>
</td>
</tr> <tr>
<td>
<div style="background-color:blue;color:white;font-weight:bold;padding:10px;cursor:pointer" onclick="toggle('divContent3')">会员管理</div> <div style="border:3px solid blue;height:100px;padding:10px" id="divContent3">This is some content to show and hide</div>
</td>
</tr>
</table>
</body>
</html>

解决方案 »

  1.   

    发错了
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script language="javascript">
    var time;
    function toggle(sDivId)
    {
    var oDiv=document.getElementById(sDivId);

    oDiv.style.display=oDiv.style.display=="none"?"block":"none";
    }
    </script></head>
    <body>
    <table width="20%">
    <tr>
    <td>
    <div style="background-color:blue;color:white;font-weight:bold;padding:10px;cursor:pointer" onclick="toggle('divContent1')">基本设置</div> <div style="border:3px solid blue;height:100px;padding:10px" id="divContent1">This is some content to show and hide</div>
    </td>
    </tr> <tr>
    <td>
    <div style="background-color:blue;color:white;font-weight:bold;padding:10px;cursor:pointer" onclick="toggle('divContent2')">新闻管理</div> <div style="border:3px solid blue;height:100px;padding:10px" id="divContent2">This is some content to show and hide<br>This is some content to show and hide<br>This is some content to show and hide<br>This is some content to show and hide<br></div>
    </td>
    </tr> <tr>
    <td>
    <div style="background-color:blue;color:white;font-weight:bold;padding:10px;cursor:pointer" onclick="toggle('divContent3')">会员管理</div> <div style="border:3px solid blue;height:100px;padding:10px" id="divContent3">This is some content to show and hide</div>
    </td>
    </tr>
    </table>
    </body>
    </html>