2
   

random image and link, using javascript

 
 
renew
 
Reply Thu 2 Oct, 2003 09:43 am
I need some javascript that will display a random image and the corresponding link.
Does anybody know of any?
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 2 • Views: 1,467 • Replies: 2
No top replies

 
Craven de Kere
 
  1  
Reply Thu 2 Oct, 2003 09:52 am
Code:<script language="JavaScript">
<!--
//Javascript by www.able2know.com

hamsterfodder = new Array(4);

hamsterfodder[0] = "<a href = 'http://www.able2know.com/index.html'><img src='http://www.able2know.com/images/image.gif' alt='Visit Able2Know'></a>";
hamsterfodder[1] = "<a href = 'http://www.able2know.com/history/index.html'><img src='http://www.able2know.com/images/image2.gif' alt='History'></a>";
hamsterfodder[2] = "<a href = 'http://www.waggery.com/index.html'><img src='http://www.able2know.com/images/image3.gif' alt='Waggery!'></a>";
hamsterfodder[3] = "<a href = 'http://www.able2know.com/craven.html'><img src='http://www.able2know.com/images/image5.gif' alt='Make sweet love to Craven by the camp fire!'></a>";

index = Math.floor(Math.random() * hamsterfodder.length);

document.write(hamsterfodder[index]);

// -->
</script>
0 Replies
 
renew
 
  1  
Reply Thu 2 Oct, 2003 10:17 am
thanks! Craven de Kere.
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » random image and link, using javascript
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/19/2024 at 01:38:08