Digital Point Forums
Moneygram

Go Back   Digital Point Forums > Design & Development > Programming > JavaScript
Google Analytics
Log In to view
your analytics

Reply
 
Thread Tools
  #1  
Old Mar 19th 2005, 10:19 am
NewComputer's Avatar
NewComputer NewComputer is offline
of the Nightfall
 
Join Date: May 2004
Location: Canada
Posts: 1,993
NewComputer will become famous soon enoughNewComputer will become famous soon enough
Rotating sponsors image script assistance needed...

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)
Reply With Quote
  #2  
Old Mar 19th 2005, 10:47 am
J.D. J.D. is offline
of the Nightfall
 
Join Date: Nov 2004
Posts: 1,198
J.D. has a spectacular aura aboutJ.D. has a spectacular aura about
You can find some more code on the topic in the thread 11620. In general, you need your own objects. For example:

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

Code:
images.push(new ImageInfo("/images/img1.jpg", "My Title"));
Finally, you will generate images like this:

Code:
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.
Reply With Quote
  #3  
Old Aug 8th 2006, 10:38 am
topwebserv's Avatar
topwebserv topwebserv is offline
Peon
 
Join Date: Aug 2006
Location: Thailand
Posts: 11
topwebserv is on a distinguished road
look at phpadsnew dot com << free advertising script easy to use [ free ]
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Url friendly php gallery script needed piniyini PHP 7 Oct 25th 2005 4:35 am
Checking source codes of image, audio and video files onauc Programming 0 Feb 21st 2005 5:34 pm
Setting up a linked image series Don Key HTML & Website Design 4 Nov 23rd 2004 1:58 pm
Assistance needed for file transfer hosting Ajeet General Business 0 Oct 6th 2004 11:12 am
Smiling Streetkids - assistance needed for awareness raising campaign Dominic General Marketing 14 Jun 16th 2004 6:01 am


All times are GMT -8. The time now is 7:20 pm.