<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);   
  } 

解决方案 »

  1.   

    是不是我题目没说清楚啊,img_001我已经定了一个宽度 width=100 这个是为了排版缩小了的现在我要用js的到该图片的实际尺寸,用楼上两位的方法得到的还是100(我设的缩小了的宽度)啊
      

  2.   

    <img id='img' src='visa_3.jpg' width='100'/>
    <script>
    var img=document.getElementById("img");
    alert(img.width);//原来设置的长
    var newImg=new Image();//新建立一个图片图象
    newImg.src=img.src;//设置图象对象的src
    alert(newImg.width);//这样输出的长和宽是原始的..
    </script>
      

  3.   

    或者这样,<img id='img' src='visa_3.jpg' width='100'/>
    <script>
    var img=document.getElementById("img");
    alert(img.width);
    //移除img的width,这样就得到原始的长了,不过图片也放大了,上面的代码不会,只是使用Image对象来获取原始的长
    img.removeAttribute("width");
    alert(img.width);
    </script>