这样看看
<script>
var $ = function (id) {
    return "string" == typeof id ? document.getElementById(id) : id;
};function bigit()
{
$("editor_body_area").style.height = ($("editor_body_area").offsetHeight+100)+"px";
return false;
}function smait()
{
$("editor_body_area").style.height = ($("editor_body_area").offsetHeight-100)+"px";
return false;
}</script>
<table width="360" border="1">
  <tr>
    <td bgcolor="#003399"><div id='editor_body_area'>点击下面图表实现div高度增加</div></td>
  </tr>
  <tr>
    <td bgcolor="#003399"><a href="javascript:void(0);" onClick="javascript:smait()">收缩编辑框</a><a href="javascript:void(0);" onClick="javascript:bigit();">扩展编辑框</a> </td>
  </tr>
</table>

解决方案 »

  1.   

    最好给个初值!
    L@_@K<!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>
        <title> new document </title>
        <meta name="generator" content="editplus" />
        <meta name="author" content="Gao YiXiang" />
        <meta name="email" content="[email protected]" />
        <meta name="keywords" content="javascript dhtml dom" />
        <meta name="description" content="I love web development." />
    </head>
    <body>
        <script>
    function bigit()
    {
        var target = document.getElementById("editor_body_area");
        target.style.height = parseInt(target.style.height)+100;
    }
    function smait()
    {
        var target = document.getElementById("editor_body_area");
        var h = parseInt(target.style.height)-100;
        if (h >= 0)
        {
            target.style.height = h;
        }
        
    }
        </script>    <table width="360" height="113" border="1">
            <tr>
                <td bgcolor="#ffdd99">
                    <div id='editor_body_area' style="height: 100px;">
                        点击下面图表实现div高度增加</div>
                </td>
            </tr>
            <tr>
                <td bgcolor="#003399">
                    <a href="#" onclick="javascript:smait()">
                        <img id="posteditor_contract" title="收缩编辑框" height="21" alt="收缩编辑框" src="images/bb_contract.gif"
                            width="11" border="0"></a>
                    <a href="#" onclick="javascript:bigit();">
                        <img id="posteditor_expand"
                        title="扩展编辑框" height="21" alt="扩展编辑框" src="images/bb_expand.gif" width="12" border="0"></a>
                </td>
            </tr>
        </table>
    </body>
    </html>