Sxsy Lady Celebrity Fashion - Debt Consolidation - Expekt bonuses - Debt Consolidation - Bollywood India forum movie reviews

PDA

View Full Version : Rotating sponsors image script assistance needed...


NewComputer
Mar 19th 2005, 10:19 am
Here is what I have so far:

Very rudimentary I know, but here it is:

var rand_int = Math.floor(Math.random()*4);
var photos = new Array(4)
photos[0] = '<img src="images/smittys-logo.gif">';
photos[1] = '<img src="images/rickys-logo.jpg">';
photos[2] = '<img src="images/rayssecurity.jpg">';
photos[3] = '<img src="images/purdys-logo.jpg">';
document.write(photos[rand_int]);

This accomplishes most of what I need, EXCEPT I would like to add above the image the actual company name. eg:

Team sponsored by (then company name inserted from .js here) <br>
(company logo inserted here by .js)

J.D.
Mar 19th 2005, 10:47 am
You can find some more code on the topic in the thread 11620. In general, you need your own objects. For example:

function ImageInfo(url, title)
{
this.url = url;
this.title = title;
}You will use this object like this:

images.push(new ImageInfo("/images/img1.jpg", "My Title"));

Finally, you will generate images like this:

img = document.getElementById("my-img-id");
img.src = images[index].url;You can also use document.write for this, but I would rather use DOM instead (the example above).

J.D.

topwebserv
Aug 8th 2006, 10:38 am
look at phpadsnew dot com << free advertising script easy to use [ free ]