View Full Version : Image changer

06-08-2003, 12:13 PM
I have a board where you can change the logo in the header, but want to change it for each forum, so it's a different image. I have this script.....

<script language="JavaScript">
for(i=0 ; i<document.images.length ; i++){
if(document.images[i].src=="URL HERE"){
document.images[i].src="URL HERE"

Is there a way to change the image without the user noticing it change. Because at the moment when you goto into a forum, you see the previous image for a split second before it changes.



06-08-2003, 02:57 PM
It would probably be better if you used a server side script to do it. Just look in hotscripts.com under images for whatever language you need.


06-08-2003, 04:08 PM
You could set the initial SRC to a blank image, then change it to the real one; that way, you wouldn't see the previous image.

Graeme Hackston
06-08-2003, 04:15 PM
document.images is depreciated, I guess because getElementsByTagName does the same thing.


.myImages {
visibility; hidden;


var document_images = document.getElementsByTagName('img')
var document_images_length = document_images.length

for(i=0 ; i<document_images_length ; i++){
if(document_images[i].src=="URL HERE"){
document_images[i].src="URL HERE"
document_images[i].style.visibility = 'visible'


<img class="myImage">

I don't understand why you're using a loop. You don't need to if it's only 1 image per page

06-08-2003, 04:31 PM
Problem is, I can't change the HTML on the forum, I can only add to it, with JS, CSS, HTML etc. It's a remotely hosted forum.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum