有个js代码可以实现自动缩小图片的功能
function img_auto_size(oldimg){
var newimg = new Image();
newimg.src = oldimg.src;
if (newimg.width > 0 && newimg.height > 0) {
if (newimg.width > 600){
oldimg.width = 600;
oldimg.height = (newimg.height * 600) / newimg.width;
oldimg.onmouseover = function() {
this.style.cursor= "hand";
};
oldimg.onmouseout = function() {
this.style.cursor="";
};
oldimg.onclick = function() {
window.open(this.src, '_blank');
};
} else {
oldimg.width = newimg.width;
oldimg.height = newimg.height;
}
oldimg.alt = "Click to view in original size " + newimg.width + " x " + newimg.height;
}
}
[此贴子已经被作者于2005-4-21 9:57:10编辑过]