Hiện forum em đã chỉnh sửa lại và thấy hoàn hảo hơn rồi! sau khi bị lỗi ý. forum em hiện giờ đang cần cái css để thu ảnh nhỏ lại giống thoaingochau.anh có không? cho em xin ạ
http://www.mediafire.com/?jct9x2dpqej7scf
Được sửa bởi KID ngày Wed Jul 21, 2010 9:29 pm; sửa lần 1.
<script>window.onload = function resizeImagesForumotion()
{
if (document.images.length > 0)
{
var maxWidth =768;
var imgHeight;
var imgWidth;
for (var i = 0; i < document.images.length; i++)
{
imgWidth = document.images[i].width;
imgHeight = document.images[i].height;
if (document.images[i].width > maxWidth && document.images[i].src != "link hình ảnh banner hoặc footer không muốn cho resize") {
image = new Image();
image = document.images[i];
newImage = image.cloneNode( true ) ;
newImage.origHeight = image.height;
newImage.origWidth = image.width;
newImage.width = maxWidth ;
imgHeight = imgHeight / (imgWidth/ maxWidth );
newImage.height = imgHeight;
newImage.style.cursor = 'pointer';
if( image.outerHTML )
{
newImage.onclick = "var altHeight; var altWidth; altHeight = this.height ; altWidth = this.width; this.width = this.origWidth; this.height = this.origHeight; this.origWidth = altWidth; this.origHeight = altHeight; ";
} else {
newImage.onclick = function () {
var altHeight;
var altWidth;
altHeight = this.height ;
altWidth = this.width;
this.width = this.origWidth;
this.height = this.origHeight;
this.origWidth = altWidth;
this.origHeight = altHeight;
};
}
if( parentNode = image.parentNode )
{
textMessage = document.createTextNode(' Hình ảnh đã được thu nhỏ, nhấn vào để xem với kích thước thật');
elem = document.createElement("td");
elem.setAttribute( "align", "center");
elem.style.backgroundColor = '#FFFFCC';
elem.style.color = '#000';
elem.style.fontSize = '10pt';
elem.appendChild( textMessage );
elem.appendChild( document.createElement("br"));
elem.appendChild( newImage );
tableRow = document.createElement("tr");
tableRow.appendChild(elem);
TableElem = document.createElement("table");
TableElem.setAttribute( "border", "0");
TableElem.appendChild( tableRow );
frag = document.createElement("div");
frag.appendChild( TableElem );
if( image.outerHTML )
{
image.outerHTML = frag.innerHTML;
} else {
parentNode.replaceChild( TableElem, image );
}
}
} }
}
} </script>
Permissions in this forum:
Bạn không có quyền trả lời bài viết
|
|