javascriptreplacewith

Replace thumb size in src


I have this code :

<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>

So, i want to change "112&h=112" size with js. Thanks for any advice!


Solution

  • So, this code work for me !

    <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>