모든 이미지로드에 크기 조정 :로드 된 모든 이미지에 호출 할자바 스크립트는이 코드있어
while ($row = mysql_fetch_assoc($result1)) {
echo "
<a href='#'id='VV".$row['id']."'>
<p>".$row['title']."</p>
<p>".$row['date']."</p>
<img onload='scale()' id='II".$row['id']."' src='../res/videos/img/".$row['img']."'/>
</a>
<script type='text/javascript'>
function scale(){
var image = document.getElementById('II".$row['id']."');
var width = image.width;
var height = image.height;
if (width > 150) {
image.style.width = '150px';
image.style.height = 'auto';
}
width = image.width;
height = image.height;
if (height > 80) {
image.style.height = '80px';
image.style.width = 'auto';
}
width = image.width;
height = image.height;
}
VV".$row['id'].".onclick = function() {
var Result = '".$row['id']."';
location.href='loged.php?Result=' + Result;
}
</script>
";
}?>
내가 크기 조정 기능을 원하는,하지만 마지막 이미지가로드 될 때 호출되고, 마지막 만 이미지가 적용됩니다. 무엇을 바꾸어야합니까?
CSS는. 브라우저가 콘텐츠를 느리게 렌더링하고 디자인이 좋지 않게 보입니다. – machineaddict
나는 그들을 확장하고있다 ... – Liukas