既然有菜单了,干吗还用frame?就算改变长度了,效果也肯定很差。还有,菜单使用的是什么?div?

解决方案 »

  1.   

    用下面的可以得到能够拉动的可瞧的部分,而offsetWidth只是可见的部分,你可以比较下,也可以用于BODY
    可用的ELEMENTSA, ADDRESS, APPLET, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, CUSTOM, DD, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FORM, HEAD, hn, HTML, I, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MENU, META, NOBR, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP
    scrollWidth Property  Internet Development Index --------------------------------------------------------------------------------Retrieves the scrolling width of the object.SyntaxHTML N/A 
    Scripting [ iWidth = ] object.scrollWidth Possible ValuesiWidth Pointer to a nonnegative long integer that specifies the width, in pixels. The property is read-only. The property has no default value.ResThe width is the distance between the left and right edges of the object's visible content.For more information about how to access the dimension and location of objects on the page through the Dynamic HTML (DHTML) Object Model, see Measuring Element Dimension and Location.Example
    When the overflow property is set to auto, the content can exceed the dimensions of an element, and scroll bars appear. You can use the scrollWidth property to retrieve the width of the content within the element.This example uses the scrollWidth property to compare the rendered width of a div element with the width of the content. The width of the element, as rendered on the page, is exposed through the offsetWidth property.
    Hide Example<SCRIPT>
    function fnCheckScroll(){
       var iScrollWidth = oDiv.scrollWidth;
       var iOffsetWidth = oDiv.offsetWidth;
       var iDifference = iScrollWidth - iOffsetWidth;
       alert("Width: " + iOffsetWidth
          + "\nContent Width: " + iScrollWidth
          + "\nDifference: " + iDifference); 
    }
    </SCRIPT>
    :
    <DIV ID=oDiv STYLE="overflow:scroll; height=200; width=250; 
       text-align:left">
    :
    </DIV>
    <INPUT TYPE=button VALUE="Check scrollWidth" 
       onclick="fnCheckScroll()">