½¨Õ¾Ñ§ - ÇáËɽ¨Õ¾´Ó´Ë¿ªÊ¼£¡

½¨Õ¾Ñ§-¸öÈ˽¨Õ¾Ö¸ÄÏ,ÍøÒ³ÖÆ×÷,ÍøÕ¾Éè¼Æ,ÍøÕ¾ÖÆ×÷½Ì³Ì

ÓÃJavaScriptʵÏÖÍøҳͼƬµÈ±ÈÀýËõ·Å

ʱ¼ä:2011-06-26 08:56À´Ô´: ×÷Õß: µã»÷: ´Î
ÔÚ´¦ÀíÍøҳͼƬʱ£¬ÌرðÊÇһЩͼƬÁбíµÄÓ¦ÓÃÀïÃ棬ºÜÄѱ£Ö¤Í¼Æ¬Í³Ò»´óС£¬Ö±½ÓÉèÖÃͼƬ´óСÓֻᵼÖÂͼƬÀ­É죬Ôì³ÉͼƬģºý£¬±¾ÎĽéÉܵĴúÂë¿ÉÒÔÔÚͼƬ¼ÓÔØÍê³Éºó×Ô¶¯°´±ÈÀýµ÷ÕûͼƬ´óС¡£   <script language="JavaScript" type="text/javascript

ÔÚ´¦ÀíÍøҳͼƬʱ£¬ÌرðÊÇһЩͼƬÁбíµÄÓ¦ÓÃÀïÃ棬ºÜÄѱ£Ö¤Í¼Æ¬Í³Ò»´óС£¬Ö±½ÓÉèÖÃͼƬ´óСÓֻᵼÖÂͼƬÀ­É죬Ôì³ÉͼƬģºý£¬±¾ÎĽéÉܵĴúÂë¿ÉÒÔÔÚͼƬ¼ÓÔØÍê³Éºó×Ô¶¯°´±ÈÀýµ÷ÕûͼƬ´óС¡£

 

<script language="JavaScript" type="text/javascript">
// ˵Ã÷£ºÓà JavaScript ʵÏÖÍøҳͼƬµÈ±ÈÀýËõ·Å
//µ÷Ó÷½Ê½£º
//  <img src="1148202890.jpg" alt="×Ô¶¯Ëõ·ÅºóµÄЧ¹û" onload="javascript:DrawImage(this,200,200);" />
//Èç¹ûͼƬ½Ï´ó£¬½¨ÒéÔÚͼƬ±êÇ©ÀïÃæͬʱÉèÖÃÆÚÍûµÄͼƬ´óС£¬ÕâÑù²»»áµ¼ÖÂÒ³ÃæÔÚ¼ÓÔØÖгſª£¬¸Ã´óС²»»áÓ°Ïì×îÖÕËõ·ÅЧ¹û¡£¿ÉÒÔÐÞ¸ÄÉÏÃæµÄ´úÂëΪ£º
//  <img src="1148202890.jpg" alt="×Ô¶¯Ëõ·ÅºóµÄЧ¹û" width="200" height="200" onload="javascript:DrawImage(this,200,200);" />
function DrawImage(ImgD,FitWidth,FitHeight){
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
        if(image.width/image.height>= FitWidth/FitHeight){
            if(image.width>FitWidth){
                ImgD.width=FitWidth;
                ImgD.height=(image.height*FitWidth)/image.width;
            }else{
                ImgD.width=image.width;
                ImgD.height=image.height;
            }
        } else{
            if(image.height>FitHeight){
                ImgD.height=FitHeight;
                ImgD.width=(image.width*FitHeight)/image.height;
            }else{
                ImgD.width=image.width;
                ImgD.height=image.height;
            }
        }
    }
}
</script>

(ÔðÈα༭£ºadmin)
Ö¯ÃζþάÂëÉú³ÉÆ÷
¶¥Ò»ÏÂ
(0)
0%
²ÈÒ»ÏÂ
(0)
0%
------·Ö¸ôÏß----------------------------
·¢±íÆÀÂÛ
Çë×Ô¾õ×ñÊØ»¥ÁªÍøÏà¹ØµÄÕþ²ß·¨¹æ£¬ÑϽû·¢²¼É«Çé¡¢±©Á¦¡¢·´¶¯µÄÑÔÂÛ¡£
ÆÀ¼Û:
񡀂:
Óû§Ãû: ÑéÖ¤Âë:µã»÷ÎÒ¸ü»»Í¼Æ¬