//ͼƭ���������� var flag=false; function drawimage(imgd,iwidth,iheight){ //����(ͼƭ,����ŀ��,����ĸ߶�) var image=new image(); image.src=imgd.src; if(image.width>0 && image.height>0){ flag=true; if(image.width/image.height>= iwidth/iheight){ if(image.width>iwidth){ imgd.width=iwidth; imgd.height=(image.height*iwidth)/image.width; }else{ imgd.width=image.width; imgd.height=image.height; } }else{ if(image.height>iheight){ imgd.height=iheight; imgd.width=(image.width*iheight)/image.height; }else{ imgd.width=image.width; imgd.height=image.height; } } } } //ͼƭ������� function changeimagesize(img) { if(img.height > 100 || img.width > 100){ if(img.height >= img.width) { img.height=100; } else { img.width=100; } } }