How to change the textures of assigned gameobjects?

Hello I have a script with this script you can change a texture by putting A link in with an image. This must change te textures of als the “boxes” because they heve the same begin texture but this is not true. this is the script:

//this is not a valid URL the player can change this i will change it to.
var url = "http://images.earthcam.com/ec_metros/ourcams/fridays.jpg";
var Box = GameObject;

	function Start () {
		// Create a texture in DXT1 format
		renderer.material.mainTexture = new Texture2D(4, 4, TextureFormat.DXT1, false);
		while(true) {
			// Start a download of the given URL
			var www = new WWW(url);

			// wait until the download is done
			yield www;

			// assign the downloaded image to the main texture of the object
			www.LoadImageIntoTexture(renderer.material.mainTexture);
		}
	}
	
	function OnGUI () {
	
	url = GUI.TextField (Rect (10, 10, 200, 20), url, 500);
	
	}

What i will is that I can give a name and that all the gameobject with that name the picture from the link as texture uses.

P.S sorry for the bas english

As robertbu pointed out you should rather use renderer.sharedMaterial to change the texture of the common material for all boxes.

When you access renderer.material, the material gets instantiated and you work with its copy, so every box will use its own copy of the material. See Unity - Scripting API: Renderer.material