View Single Post
Old 09-29-2018, 10:49 AM  
blackmonsters
Making PHP work
 
blackmonsters's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,241
Quote:
Originally Posted by 2MuchMark View Post
Greetings earthlings,

I have a program that generates the URL of am image that looks like this

http://something.jpg

and it appears in the img code like this:

<img src = "http://something.jpg">


What I need is a javascript that will insert a 1 into the file name so that the URL looks like this

http://1something.jpg"

so that the code looks like

<img src = "<script>blahblah</script>">


STUPID question I know, but I just can't seem to figure this out. Any help gets you titties. thanks!

Code:

<script>

 	document.addEventListener("DOMContentLoaded", function(event) {
   		var imgs = document.getElementsByTagName("img");
		var ctr = imgs.length;
		var i;
		for (i = 0; i < ctr; i++) { 

			hold = imgs[i].src;
			imgs[i].src = hold.replace("https://","https://1");
		}
	});


</script>


** Proudly accepting spare change at paypal to get account out of negative.


__________________
Make Money with Porn
blackmonsters is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote