jq加点js控制图片的宽度 不指定

Else , 2010/01/26 14:53 , 积累些,自己也写些 , Comments(0) , Reads(806) , Via Original


这个代码放在</body>的前面
function autopic()
{
  
  $("#cont img").each(function(i){
  if(this.width>600){this.width=600;}
  
  });
  
  $("#content img").each(function(i){
    if(this.width>200){this.width=200;}
    if(this.height>160){
      this.height=160;
      
      }
    });


}


这个代码下在html的后面
<script  type="text/javascript">
if (document.readyState=="complete")
{
          autopic();
}
else
{
document.onreadystatechange = function()
{

  if (document.readyState == "complete")
  {
  autopic();
  }
}
}
</script>
Add a comment

Nickname

Site URI

Email

Enable HTML Enable UBB Enable Emots Hidden Remember [Login] [Register]