<script>
var img=null;
function s()
{
if(img)img.removenode(true);
img=document.createelement(img);
img.style.position=absolute;
img.style.visibility=hidden;
img.attachevent(onreadystatechange,orsc);
img.attachevent(onerror,oe);
document.body.insertadjacentelement(beforeend,img);
img.src=inp.value;
}
function oe()
{
alert(cant load img);
}
function orsc()
{
if(img.readystate!=complete)return false;
alert(圖片大?。?img.offsetwidth+x+img.offsetheight);
alert(圖片尺寸:+img.filesize);
}
</script>
<input id=inp type=file>
<br>
<button onclick=s()>test</button>