I'm new to Jscript but trying to combien it with CSS to build a website. I need to do the following:
1) Read the img src property in the mainPicture DIV
2) Replace a string in the actual name of the image
3) Store the new result and pathname
The code I have so far is this:
var currentPicture = document.getElementById("mainPicture").getElementsByTagName("img").src;
This works well for part 1, but gives me the path of the image relative to the Document vs. the Site Root (C:/website/me/images/pic1_before.jpg instead of /images/pic1_before.jpg). I need to get the Site Root path.
For part 2, what code do I write to take the string pic1before.jpg and change it to pic1after.jpg?
For part 3, how do I then save the whole string /images/pic1_after.jpg? I will be applying it somewhere else.
Hope this makes sense and thanks in advance for helping.