【个人意见,仅供参考】
body
{
    overflow:auto;
}
样式可以实现:控制滚动条在文本过长时自动显示,否则隐藏。所以不妨试一试修改这个属性。

解决方案 »

  1.   

    【个人意见,仅供参考】overflow有 auto;hidden;inherit;scroll;visible几个可选值,不妨试一试;
    document.body.style.overflow = '<几个待选值>'
      

  2.   

    【个人意见,仅供参考】还是不太清楚你的意思:是要这样的效果吗?
    <script language="javascript">
    function Show(IsShow){
    document.body.style.overflow = IsShow?'scroll':'hidden';
    }
    </script><body style="overflow:scroll;">
    <input type="button" value="显示滚动条" onclick="Show(true)"/>
    <input type="button" value="隐藏滚动条" onclick="Show(false)" />
    <script language="javascript">
    for(var i=0; i<100; i++){
    document.write('<br>变长');
    }
    </script>
    </body>
      

  3.   

    感谢你的回答,我把你的代码页面放入我的框架就出现框架的滚动条,我是要控制这个滚动条。代码如下:
    defalut.htm
    <!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>无标题页</title>
    </head>
     
    <frameset rows="76,75%">
    <frame   id="banner" name=banner src="Top.aspx" frameBorder=0 noResize scrolling=no target="main">
     <frameset border="0" frameSpacing="0" frameBorder="0" cols="240,79%" scrolling="no" noresize>
    <frame id="contents" name="contents" src="Menu.htm" target="main" scrolling="auto">
    <frame name="main" scrolling="auto" >
    </frameset> 
     
    </frameset>
    </html>用你的代码页面
    menu.htm
    <!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>无标题页</title>
    </head>
    <script language="javascript">
    function Show(IsShow){
        document.body.style.overflow = IsShow?'scroll':'hidden';
    }
    </script><body style="overflow:scroll;">
    <input type="button" value="显示滚动条" onclick="Show(true)"/>
    <input type="button" value="隐藏滚动条" onclick="Show(false)" />
    <script language="javascript">
        for(var i=0; i<100; i++){
            document.write('<br>变长');
        }
    </script>
    </body>
    </html>
      

  4.   

    【个人意见,仅供参考】<!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>无标题页</title>
    </head>
    <script language="javascript">
    function ShowFrame(pge,iframeid, mode) { // mode can be either "yes" or "no"
         var oldIframe = parent.document.getElementById(iframeid);
         var newIframe = oldIframe.cloneNode(true);
         newIframe.scrolling = mode;
         oldIframe.parentNode.insertBefore(newIframe, oldIframe);
         newIframe.parentNode.removeChild(oldIframe);
    }
    </script><body style="overflow:hidden;">
    <input type="button" value="显示框架滚动条" onclick="ShowFrame('menu.htm','contents','yes')"/>
    <input type="button" value="隐藏框架滚动条" onclick="ShowFrame('menu.htm','contents','no')" />
    <script language="javascript">
        for(var i=0; i<100; i++){
            document.write('<br>变长');
        }
    </script>
    </body>
    </html>
      

  5.   

    【个人意见,仅供参考】
    在修改一下,这个是Menu.htm<!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>无标题页</title>
    </head>
    <script language="javascript">
    function ShowFrame(iframeid, mode) { // mode can be either "yes" or "no"
     var oldIframe = parent.document.getElementById(iframeid);
     var newIframe = oldIframe.cloneNode(true);
     newIframe.scrolling = mode;
     oldIframe.parentNode.insertBefore(newIframe, oldIframe);
     newIframe.parentNode.removeChild(oldIframe);
    }
    </script><body style="overflow:hidden;">
    <input type="button" value="显示框架滚动条" onclick="ShowFrame('contents','yes')"/>
    <input type="button" value="隐藏框架滚动条" onclick="ShowFrame('contents','no')" />
    <script language="javascript">
        for(var i=0; i<100; i++){
            document.write('<br>变长');
        }
    </script>
    </body>
    </html>
      

  6.   

    LZ的题意说得不清楚啊。
    如果是控制是否显示的话,LS的已经说得很清楚了。如果是控制滚动条移动或定位的话,请参见W3C。