欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js兼容火狐獲取圖片寬和高的方法

 更新時(shí)間:2015年05月21日 09:52:29   作者:3H  
這篇文章主要介紹了js兼容火狐獲取圖片寬和高的方法,涉及javascript圖片操作的相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了js兼容火狐獲取圖片寬和高的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

<!doctype html> 
<html> 
<head> 
<meta content="text/html; charset=GBK" http-equiv="Content-Type" /> 
<title>獲取Image 寬高</title>
</head> 
<body>
<script>
function newimage(obj) {
  a = new Image();
  var objectURL = window.URL.createObjectURL(obj.files[0]);
  var img= document.getElementById('img')
 img.src = objectURL;
  a.src = objectURL;
 img.onload=function (){
 alert(img.width);
 alert(img.height);
 }
}
</script>
<input id="idcardfile" type="file" name="idcardfile" 
onchange="newimage(this)"/>
<img id="img" style="display: none;">
</body> 
</html>

希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論