I have a div with Class name "separator" which holds a URL with different paths, but there is one similarity in each URL. what i did is get the URL from that div and replace a specific parameter.
HTML Code:
<div class="separator">
<a href="http://www.mydomain.com/images/s1600/photo.jpg"><img src="http://www.mydomain.com/images/s1600/photo.jpg" height="225" width="400" /></a>
</div>
Here is the JavaScript Code:
var ImageSource = document.getElementsByClassName('separator')[0].getElementsByTagName('a')[0].href;
ImageSource = ImageSource.replace("0", "0-d");
This code works fine, i only want to target the last 0 from /s1600/ because when this value has 2 Zeros it outputs like this:
http://www.mydomain.com/images/s160-d0/photo.jpg
Which should be
http://www.mydomain.com/images/s1600-d/photo.jpg
Please suggest some solution... Thanks :)