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

Else , 2010/01/26 14:53 , 积累些,自己也写些 , 评论(0) , 阅读(415) , Via 本站原创 | |


这个代码放在</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>
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]