我已經搜索過此內容,但是每次執行代碼時,它會返回24作爲高度和寬度,當我上傳400X400
圖片時,將返回24。獲取圖片尺寸(高度和寬度)Js或jquery
$(document).on('change','#tt' , function(){
var img = document.getElementById('tt');
var nheight = img.clientHeight;
var nwidth = img.clientWidth;
alert(nheight)
alert(nwidth)
});
<input type="file" id="tt" name="tt" >
是任何人都知道我能得到400的身高和400的警告框寬度當我上傳400X400
圖像。任何幫助真的很讚賞.....
你試圖讓寬度和輸入的高度不圖像。 – Mohammad
現在得到了..謝謝。 @Mohammad – Aamir