do you mean document.forms[0].txtWidth.value and document.forms[0].txtHeight.value???
<form>
 <img name=picView>
 <input type=file name=file>
 <input name=txtWidth>
 <input name=txtHeight>
 <input type=button onclick="GetDimension()" value=get>
</form><script language="javascript">
function GetDimension()
{
if (document.forms[0].file.value == "")
return;

document.forms[0].picView.src= document.forms[0].file.value;
document.forms[0].picView.onload = function() {
            document.forms[0].txtWidth.value=this.width;
            document.forms[0].txtHeight.value=this.height;
}
}
</script>

解决方案 »

  1.   

    加入<img id=img1 ..>时不要设置宽高,然后img1.clientHeight;img1.clientWidth;
      

  2.   

    document.forms[0].picView.src=document.forms[0].file.value;
            document.forms[0].txtWidth=document.forms[0].picView.width;
            document.forms[0].txtHeight=document.forms[0].picView.Height;应该是:
            document.forms[0].txtWidth.value=document.forms[0].picView.width;
            document.forms[0].txtHeight.value=document.forms[0].picView.Height;
      

  3.   

    NorthMan (青铜圣斗士:黑暗天龙)  可以把整页代码贴出来吗?
      

  4.   

    用fso是一个得到文件大小的方法。
     不知道大侠们取得文件大小更好的办法是什么?
      

  5.   

    <img src=http://expert.csdn.net/images/csdn.gif onclick=alert(this.fileSize/1024+"KB")>
      <img src=http://expert.csdn.net/images/csdn.gif border=0 onload="alert('width : '+ this.clientWidth + '\r\nheight : '+ this.clientHeight)">
     
     
      

  6.   

    agree kypfos(kypfos)<img src=http://expert.csdn.net/images/csdn.gif border=0
     onload="alert('filesize : '+ fileSize +' Byte\r\nwidth  : '+ clientWidth + '\r\nheight : '+ clientHeight)">
      

  7.   

    to kypfos(kypfos): this.fileSize/1024 kypfos(kypfos) 
    我想保留小数点2位小数,该怎么写?
    round(kypfos(kypfos),2)怎么不可以呢?缺少对象错误!
      

  8.   

    <input type=file id=meizz onpropertychange="mm(this.value)"><SCRIPT LANGUAGE="JavaScript"><!--
    function mm(s)
    {
      var img = new Image();
      img.src = s;
      alert("高 = "+ img.height + "\n宽 = "+ img.width);
      alert("fileSize = "+ img.fileSize +" 字节");
    }
    //--></SCRIPT>