TripperTreats
12-20-2006, 04:26 AM
Hello,
So I need to create an image with Javacript: var img = new Image().
Its source will change every now and then. The catch is, I need to display that image in several places on my page using document.write. All I can think of is
document.write('<img id="test1" src="'+img.src+'");
...
document.write('<img id="test2" src="'+img.src+'");The problem is, the browser loads a copy of img each time I try to display it in these placeholders. On my particular page, I have up to 36 copies of that image that I need to display, so that it downloads 36 copies of it! I know there is an easier way to do this. Any help would be much appreciate. The applicable page is
www.trippertreats.com/Products/Teachers/ (http://www.trippertreats.com/Products/Teachers/)
Thanks!
So I need to create an image with Javacript: var img = new Image().
Its source will change every now and then. The catch is, I need to display that image in several places on my page using document.write. All I can think of is
document.write('<img id="test1" src="'+img.src+'");
...
document.write('<img id="test2" src="'+img.src+'");The problem is, the browser loads a copy of img each time I try to display it in these placeholders. On my particular page, I have up to 36 copies of that image that I need to display, so that it downloads 36 copies of it! I know there is an easier way to do this. Any help would be much appreciate. The applicable page is
www.trippertreats.com/Products/Teachers/ (http://www.trippertreats.com/Products/Teachers/)
Thanks!