http://fason.nease.net/libary/js/javascript.zip

解决方案 »

  1.   

    clientWidth--------------------------------------------------------------------------------DescriptionReturns the width of the element, in pixels. This width does not take into account any margin, border, scroll bar, or padding that might have been applied to the element. Syntax
    object.clientWidthResThis property has read-only permission, meaning you can retrieve its current value, but not change it. For more information on how to access the dimension and location of elements on the page through the document object model, seeMeasuring Element Dimension and Location. Applies ToAPPLET, BODY, BUTTON, CAPTION, DIV, EMBED, FIELDSET, IMG, INPUT, LEGEND, MARQUEE, OBJECT, SPAN, TABLE, TD, TEXTAREA, TR 
    --------------------------------------------------------------------------------
    DescriptionReturns the width of the element relative to the document's top-left corner. Syntax
    object.offsetWidthResUsing a combination of offset* properties, you can determine the location, width, and height of an element by using the offsetLeft, offsetTop, offsetHeight, and offsetWidth properties. These numeric properties specify the physical coordinates and dimensions of the element relative to the element's offset parent. For example, the following document is a simple clock that adjusts the size of its readout to fit the current width and height of the document body. <HTML>
    <HEAD><TITLE>A Simple Clock</TITLE>
    <SCRIPT LANGUAGE="JScript">
    function startClock() {
        window.setInterval("Clock_Tick()", 1000);
        Clock_Tick();
    }var ratio = 4;
    function Clock_Tick()
    {
        var s = Date();
        var t = s.substring(11,19);
        var doc_height = document.body.offsetHeight;
        var doc_width = document.body.offsetWidth;    if ((doc_height*ratio)>doc_width)
            doc_height = doc_width / ratio;
        document.all.MyTime.innerText = t;
        document.all.MyTime.style.fontSize = doc_height;
    }
    </SCRIPT>
    <BODY onload="startClock()">
    <P ID="MyTime">&nbsp;</P>
    </BODY>
    </HTML>This property has read-only permission, meaning you can retrieve its current value, but not change it. For more information on how to access the dimension and location of elements on the page through the document object model, seeMeasuring Element Dimension and Location. Applies ToA, ACRONYM, ADDRESS, APPLET, AREA, B, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, H1, H2, H3, H4, H5, H6, HR, I, IFRAME, IMG, INPUT, INS, KBD, LABEL, LEGEND, LI, LISTING, MAP, MARQUEE, MENU, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP pixelWidth--------------------------------------------------------------------------------DescriptionSets or retrieves the width of the element, in pixels. Unlike the width property, this property's value is an integer, not a string, and is always interpreted in pixels. Syntax
    object.pixelWidth[ = pixelWidth]
    SettingsThis read-write property can be any integer value. Setting this property changes the value of the height without changing the units designator. ResFor more information on how to access the dimension and location of elements on the page through the document object model, seeMeasuring Element Dimension and Location. Applies Tostyle CSS Attributewidth See Also
    posWidth 
    --------------------------------------------------------------------------------这些是我在自己机子上找的 htmlref.chm 中的。
    简单地说(有什么不对的地方请指正):
    clientWidth:客户端宽(最好理解成元素宽),但不包含任何边距/间距/边框/滚动条的部分。
    offsetWidth:相对于文档左上角的元素宽。
    PixelWidth:象素宽,基本和Width查不多,但它是整数。看看这个,爆有用:
    http://msdn.microsoft.com/workshop/graphics/dhtmlpos.gif最完则怀念感的参考资料就是MSDN啦。
      

  2.   

    http://msdn.microsoft.com/workshop/graphics/dhtmlpos.gif
    还是看图示比较清楚
      

  3.   

    clientWidth:
    Returns the width of the element, in pixels. This width does not take into account any margin, border, scroll bar, or padding that might have been applied to the element.
    返回,用像素,来表示的元素宽度,这个宽度不包括边框和状态条那些东东。
    offsetWidth:
    Returns the width of the element relative to the document's top-left corner. 
    返回元素的相对于窗体左上角的偏离宽度PixelWidth:
      

  4.   

    PixelWidth:
    Setting this property changes the value of the width without changing the units designator. Unlike the width property, the pixelWidth value is an integer, not a string, and is always interpreted in pixels.
    设置元素的宽度
    和WIDTH一样,只是它是一个INT的使用像素的
    上面的人都说了,
    学会去查MSDNhttp://msdn.microsoft.com/workshop/author/dhtml/reference/properties/pixelwidth.asp?frame=true
    http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/offsetwidth.asp
    http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/clientwidth.asp作为一个写程序的,MSDN是经常会用到的,
      

  5.   

    Estyle(靳田),你的那个htmlref.chm ,能发给我吗?谢谢!!!
    [email protected]
    谢谢各位,!我不知道MSDN还会有HTML的东西,而且太大个儿,我也没必要为了HTML装这么大的家伙。有没有专门的HTML的?如果有很快就结贴,各位大哥都有分,提供完整文档的给1000分。
      

  6.   

    ms-help://MS.VSCC/MS.MSDNVS.2052/CSS/workshop/author/om/measuring.htm
      

  7.   

    哦,这是MSDN里的?确实有.谢谢fason(【阿信(你是我的温柔)】) !
    这个是够全的了。原来自己机器上有还找了N年。也是因为平时不怎么用比较深的东西,常用的都有模板,也不用改
    这样吧,给每人开个贴,100分,如何。