js检测显示图片的宽高(兼容各浏览器)
- <img src="http://www.baidu.com/img/baidu_logo.gif" width="500" id="imgs" />
- <script>
- document.write("宽:"+imgs.width+" 高:"+imgs.height);
- </script>
- <br />
- <img src="http://www.baidu.com/img/baidu_logo.gif" id="image" />
- <script>
- document.write("宽:"+image.width+" 高:"+image.height);
- </script>
本文转自许琴 51CTO博客,原文链接:http://blog.51cto.com/xuqin/1033341,如需转载请自行联系原作者