CodeAve.com CodeAve.com - ASP - Random Functions
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Random Hyperlinked Images
Hyperlinking random images is an quick and easy way to make a page look unique from others in the same template and enables you to highlight specific places within your website (or others) you want to drive traffic to. The following example contains links to seven of the most popular search engines and their logos. Each time the page is refreshed the script will select a random number from one to seven and dynamically write the appropriate image and hyperlink to the browser.
View the Output
Text View
Print View
Mail this Link
Download the Code

<%
' Sets the upper limit for the random number
limit=7
' Redim allows for arrays to be setup by passing a numeric value
' rather than hardcoding the numeric value for the limit multiple times
redim link(limit)
redim image (limit)

' List of images and links
link(1)="http://www.yahoo.com"
image(1)="http://us.yimg.com/images/yahoo.gif"

link(2)="http://www.excite.com"
image(2)="http://www.excite.com/mesp/images/excite/new_logo-180.gif"

link(3)="http://www.lycos.com"
image(3)="http://a284.g.akamai.net/7/284/987/000/lygo.com/ly/i/lyguide.gif"

link(4)="http://www.cnet.com"
image(4)="http://cnet.com/Images/Headers/cnet-1-title.gif"

link(5)="http://www.go.com"
image(5)="http://www.go.com/images/hp/go_logo_121_58.gif"

link(6)="http://www.webcrawler.com"
image(6)="http://webcrawler.com/img/web/hdr/home_header.gif"

link(7)="http://www.go.com"
image(7)="http://www.go.com/images/hp/go_logo_121_58.gif"

' produces the randome number from 1 to the value of limit
randomize
random=int(rnd*limit)+1

'Writes the randomly selected hyperlink and image to the browser
%>

<center>
<a href="<%= link(random) %>">
<img src="<%= image(random) %>" border="0"></a>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3