对啊,一些msg是些表了,它的高度是有四个值,比如我现在知道要显示那个表,但是我现在不知道怎么把它的高度得出啊,因为还要给出正确位置才能算出啊 !!
怎么办,好矛盾!!!

解决方案 »

  1.   

    to:net_lover(孟子E章) 
    那你说怎么做啊!!!
      

  2.   

    <div id=mxh style="position:relative">开始</div>
    <input type=button value="设置div" onclick="document.all.mxh.innerHTML='<p>test</p><p>test</p><p>test</p><p>test</p><p>test</p>'">
    <input type=button value="设置div" onclick="document.all.mxh.innerHTML='<p>test</p><p>test</p>'">
    <input type=button value=得到div onclick="alert(document.all.mxh.offsetHeight)">
      

  3.   

    clientHeight Property--------------------------------------------------------------------------------Retrieves the height of the object including padding, but not including margin, border, or scroll bar. SyntaxHTML              N/A 
    Scripting         [ iHeight = ] object.clientHeight Possible ValuesiHeight
    Integer that receives the height of the object, in pixels. The property is read-only. The property has no default value.
      

  4.   

    var intlength;
    var msg;
    intlength=msg.length;不会是这样吧?得到字符串长度吗?
      

  5.   

    我以前用过很笨的方法来解决这个问题,高度都可以根据FONT的值来定,你可以根据你选定的字体来试出高度,字符串的长度比较麻烦因为会与双字节的汉字与单字节的英文字母在字符串长度相同的情况下长度是不一样的,总之思路是先得出字符串的长度,再用一个经验公式来算出你要的长度。