I'm new to the site and JavaScript. Please help in the correct implementation of the code. I'm trying to change to replace part of the url for the picture.
For https://website.com/data/thumb/123/th_pic.jpg
Get this https://website.com/data/images/123/pic.jpg
for(var i=0;i<document.images.length;i++){
if(document.images[i].src.indexOf("thumb/")!=-1 && document.images[i].src.indexOf("images/")==-1){
document.images[i].src=document.images[i].src.replace(/thumb\//i, "images/");
}
else(document.images[i].src.indexOf("th_")!=-1 && document.images[i].src.indexOf(" ")==-1){
document.images[i].src=document.images[i].src.replace(/th_\//i, " ");
}
}