it would be a bad idea to do this with javascript. I'd recommend simply using find and replace all in your css.
find url(/img replace url(/subdir/img nomen wrote:
Hi all: I have a website. All my images are in "/img" directory. Now, my client needs to put the site in a subdirectory, so, my images are now in "/subdir/img". In the future, maybe we have to change the site to another subdirectory. I don“t want to change all my CSS anytime the client changes the subdirectory. So my question is: Is there a simple way to change all CSS background-image property with the next logic: "Change all the existing CSS background-image properties in this way: if the url starts with "/img" change to "/subdir/ img" else do nothing" Thank you for your help in advance.