这样做<input id="FileUpload" type="file" size="27" name="FileUpload" onpropertychange="javascript:img2.src=this.value;">
<img id="img2" src="" style="visibility:hidden;position:absolute;top=-10000"/>
<input type="button" value="获取" onclick="javascript:abc();">
<script language="javascript">
function abc()
{
alert(img2.width);
}
</script> <br>
还没有吗?

解决方案 »

  1.   

    参考:
    <FORM name=form action="" method=post encType=multipart/form-data>
    <INPUT onpropertychange=document.all.aaaa.src=this.value type=file name=upload>
    <BR>
    宽:<INPUT name=W> 
    高:<INPUT name=H><BR>
    <INPUT type=submit value=提交>
     <IMG style="POSITION: absolute; TOP: -100000px" onerror='alert("类型错误或者目标不存在");'
    onload={document.all.W.value=this.width;document.all.H.value=this.height;} name=aaaa>
     </FORM>
      

  2.   

    我自己写了下:
    <input id="FileUpload" style="WIDTH: 280px; HEIGHT: 22px" type="file" size="27" name="FileUpload" onpropertychange="javascript:GetImage(this);">
    <input type="hidden" id="heWight" value="" NAME="heWight"/>
    <input type="hidden" id="heHeight" value="" NAME="heHeight"/>
    <div style="visibility:hidden;width:0;z-index:3;">
    <img id="img2" src="" /></div>
    <input type="button" value="ssdsfsf" onclick="javascript:alert(heWight.value);">
    <script language="javascript">
    function GetImage(e)
    {
    img2.src=e.value
    img2.style.display="";
    heWight.value = img2.width;
    img2.style.display="none";
    }
    </script> 解决了 呵呵