示例代码:

<div >
    <img src="http://static.cnblogs.com/images/logo_small.gif" alt="Alternate Text" />
</div>

<script type="text/javascript">
    $(document).ready(function () {
        var myimg;
        var maxwidth = 643;
        $("#div_content img").load(function () {
            for (i = 0; i < $(this).length; i++) {
                myimg = $(this)[i];
                if (myimg.width > maxwidth) {
                    myimg.width = maxwidth;
                }
            }
        });
    });
</script>

参考资料:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-01-18
  • 2021-09-29
  • 2022-12-23
  • 2021-05-31
猜你喜欢
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案