function ReImgSize(){ for (i=0;i<document.images.length;i++) { if (document.all){ if (document.images[i].width>500) { var oWidth=document.images[i].width; var oHeight=document.images[i].height; document.images[i].width="500"; document.images[i].height=oHeight*500/oWidth; document.images[i].outerHTML='<a href="'+document.images[i].src+'" target="_blank" title="在新窗口打开图片">'+document.images[i].outerHTML+'</a>' } } else{ if (document.images[i].width>500) { var oWidth=document.images[i].width; var oHeight=document.images[i].height; document.images[i].width="500"; document.images[i].height=oHeight*500/oWidth; document.images[i].title="在新窗口打开图片"; document.images[i].style.cursor="pointer" document.images[i].onclick=function(e){window.open(this.src)} } } } }
var oWidth=document.images[i].width; var oHeight=document.images[i].height; document.images[i].width="500"; document.images[i].height=oHeight*500/oWidth;