首页 > 解决方案 > 替换 src 中的拇指大小

问题描述

我有这个代码:

<div class="track">
<a href="#" rel="loadpage"><img src="http://localhost/thumb.php?src=2015381915_1861178087_859395037.jpg&amp;t=m&amp;w=112&amp;h=112" alt="alt"></a
</div>

所以,我想用 js 改变“112&h=112”的大小。感谢您的任何建议!

标签: javascriptreplacewith

解决方案


所以,这段代码对我有用!

<script type="text/javascript">
        window.onload=function(){
        $("img").each(function(){
            var src=$(this).attr("src");
          src=src.replace("112&h=112","200&h=200");
          var src=$(this).attr("src",src);
        });
        }
</script>

推荐阅读