<script language=javascript>
function index_image_valid(){
document.pho_up.indeximg.src=document.pho_up.pho_index.value;
imagewidth=document.pho_up.indeximg.width;
imageheigth=document.pho_up.indeximg.height;
alert ("宽:"+imagewidth+"\n高:"+imageheigth);
}
function index_image_valid(){
document.pho_up.indeximg.src=document.pho_up.pho_index.value;
imagewidth=document.pho_up.indeximg.width;
imageheigth=document.pho_up.indeximg.height;
alert ("宽:"+imagewidth+"\n高:"+imageheigth);
}
<script>
var img=document.getElementById("img");
alert(img.width);//原来设置的长
var newImg=new Image();//新建立一个图片图象
newImg.src=img.src;//设置图象对象的src
alert(newImg.width);//这样输出的长和宽是原始的..
</script>
<script>
var img=document.getElementById("img");
alert(img.width);
//移除img的width,这样就得到原始的长了,不过图片也放大了,上面的代码不会,只是使用Image对象来获取原始的长
img.removeAttribute("width");
alert(img.width);
</script>