我有许多.html页面中的客户端特定图像,我想将图像路径从默认文件夹重定向到其他文件夹。jQuery - 图像路径替换文件夹错误
我试图从外部 JavaScript文件这是预期工作实现通过下面的代码相同。但是,收到错误和HTML源仍呈现
我得到了如下错误,虽然图像作为旧文件路径加载
GET file:///E:/User/Images/test.png net::ERR_FILE_NOT_FOUND
PS:我这样做SCR
$(document).ready(function() {
$(function() {
var img = $("img");
img.each(function() {
var src = $(this).attr('src');
if (src.indexOf('Images/') > -1) { // Default path of the images
$(this).attr('src', src.replace("Images", "Images/client")); // New path
}
});
});
});
此外,如果我检查源代码,它仍然显示为Images/test.png
而不是Images/client/test.png
@RIYAJKHAN,你为什么将他重定向到那个页面,你看过他的代码吗? –