开发者

How to make the browser display image with same name and not the cached one?

开发者 https://www.devze.com 2022-12-15 02:31 出处:网络
I have solved this with PHP by adding the \'time()\' to the img src tag. But how is it done with Javascript, same way?

I have solved this with PHP by adding the 'time()' to the img src tag.

But how is it done with Javascript, same way?

Here is my code:

 th_div_html+= "<img src='"+path_th_img+"' class='shadow2' style='margin:7px;' onclick='imageShow("+z+");'&g开发者_Python百科t;";

I'm better with PHP than javascript so I need your help on this one.

How can I add something like the 'time()' function to this img tag with javascript ?

Thanks


img.src = 'img.jpg?' + Math.random();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号