Log in

View Full Version : Random Logos


Reece^B
01-23-2006, 04:25 PM
Hey guys,
whats the code to make random logos appear?
Thanks
Reece

is it just a simple code?
Cheers

can anyone tell me?
I need to find out by friday.

rudiviss1
01-24-2006, 08:25 PM
Try JavaScript Random Image Code, should be able to find easy enough :)

Reece^B
01-25-2006, 02:41 PM
Rudi, LOL, i've fixed it. and you knew i had to code.

For all members:


<script language="JavaScript">
<!--
// Create arrays to contain all the values
// for image locations

image = new Array

image[1]="http://us.yimg.com/images/yahoo.gif"
image[2]="http://www.excite.com/mesp/images/excite/new_logo-180.gif"
image[3]="http://a284.g.akamai.net/7/284/987/000/lygo.com/ly/i/lyguide.gif"
image[4]="http://cnet.com/Images/Headers/cnet-1-title.gif"
image[5]="http://webcrawler.com/img/web/hdr/home_header.gif"

// Create a random number between 1 and five
random_num = (Math.round((Math.random()*4)+1))


// Write the image tag with a random array element
document.write("<img src=\"" + image[random_num] + "\">");

-->
</script>


Insert Code Into "Header"

bada_bing
01-25-2006, 02:43 PM
Rudi, LOL, i've fixed it. and you knew i had to code.

For all members:


<script language="JavaScript">
<!--
// Create arrays to contain all the values
// for image locations

image = new Array

image[1]="http://us.yimg.com/images/yahoo.gif"
image[2]="http://www.excite.com/mesp/images/excite/new_logo-180.gif"
image[3]="http://a284.g.akamai.net/7/284/987/000/lygo.com/ly/i/lyguide.gif"
image[4]="http://cnet.com/Images/Headers/cnet-1-title.gif"
image[5]="http://webcrawler.com/img/web/hdr/home_header.gif"

// Create a random number between 1 and five
random_num = (Math.round((Math.random()*4)+1))


// Write the image tag with a random array element
document.write("<img src=\"" + image[random_num] + "\">");

-->
</script>


Where and how to I apply this code? I have been wanting to do this? Also how can yo do this for certain usergroups?

Just wanted to get an update

Just want to get an update to my reply

rudiviss1
01-25-2006, 05:05 PM
Where and how to I apply this code? I have been wanting to do this? Also how can yo do this for certain usergroups?

Just wanted to get an update

Just want to get an update to my reply

Ok, the code goes in the header template, replace the current image URLs with the images of your logos, can be used with as many or as little images as you want ;) But remember to change the random number array to comply with the image amount :)

eg.
2 images
// Create a random number between 1 and five
random_num = (Math.round((Math.random()*1)+1))
Notice the bold change.

Another small thing...

To remove the borders of the images, replace
document.write("<img src=\"" + image[random_num] + "\">");
with
document.write("<img src=\"" + image[random_num] + "\"border="0">");

Reece^B
01-26-2006, 05:15 AM
Yeah Rudi it's pretty much straight fodward.
If you have any worries, PM me.

Reece