文本我有這樣的代碼應用從圖像的高度和寬度
<script src='js.js'></script>
<script>
(function($){
var img = document.getElementsByClassName('x'),
L = img.width(),
T = img.height();
for (var i=0,len=img.length;i<len;i++){
img[i] = $('#u').text("Width" + L + "Height " + T)
}
});
</script>
<div id='image'>
<img class='x' src='1.jpg'/>
<span id='u'></span>
</div>
<div id='image'>
<img class='x' src='5.jpg'/>
<span id='u'></span>
</div>
我想在<span id='u'></span>
申請文本的寬度和圖像的高度,但不起作用,
圖像不能完全加載到document.ready ..使用加載圖像來設置文本 – Amitd 2013-05-12 03:45:27
帶有相同的ID? – 2013-05-12 05:19:19