Results 1 to 3 of 3

Thread: Urgent Help! Please ASAP

  1. #1
    Join Date
    Aug 2004

    Exclamation Urgent Help! Please ASAP

    Hi! I am making my bands website, n i though this template would make my vision easy to do..but it hasn't worked out how i'd of liked it to.


    I have already put the other half of the script in, but it is this part which is wrong. It is script so that every time the home page is visited, 1 of 6 images appears at random adding variety...however, 4 of the images link to different areas of the site (this is possible?)

    Below is the script..if you could help me based on what I offer you, or even correct it for me, i'd be so appriciative..as i'm pulling my hair out over this.


    <script language="JavaScript" type="text/javascript">
    // This script was supplied free by Hypergurl
    // http://www.hypergurl.com
    // JavaScript to interpolate random images into a page.
    var ic = 6; // Number of alternative images
    var xoxo = new Array(ic); // Array to hold filenames

    xoxo[0] = "http://www.penitentiary.co.uk/Home%20Page%20Adverts/13th%20March%20Gig%20Edit.jpg";
    xoxo[1] = "http://www.penitentiary.co.uk/Home%20Page%20Adverts/EPADlarge.jpg";
    xoxo[2] = <p align="center"><a href="http://www.penitentiary.co.uk/EPcoverdesigns.htm"><img src="http://www.penitentiary.co.uk/Home%20Page%20Adverts/epcoverdesignAD.jpg"></a>;
    xoxo[3] = <p align="center"><a href="http://www.penitentiary.co.uk/Flyers.htm"><img src="http://www.penitentiary.co.uk/Home%20Page%20Adverts/FlyersADlarge.jpg"></a>;
    xoxo[4] = <p align="center"><a href="http://www.penitentiary.co.uk/forum/index.php"><img src="http://www.penitentiary.co.uk/Home%20Page%20Adverts/ForumADlarge.jpg"></a>;
    xoxo[5] = <p align="center"><a href="http://www.penitentiary.co.uk/news.htm"><img src="http://www.penitentiary.co.uk/Home%20Page%20Adverts/MailinglistADlarge.jpg"></a>;

    function pickRandom(range) {
    if (Math.random)
    return Math.round(Math.random() * (range-1));
    else {
    var now = new Date();
    return (now.getTime() / 1000) % range;
    // Write out an IMG tag, using a randomly-chosen image name.
    var choice = pickRandom(ic);
    // -->
    Last edited by Blade376; 08-25-2004 at 08:05 PM.

  2. #2
    Join Date
    Sep 2004
    This is something similar to what I am trying to do, Blade. So far, I am still unsuccessful.

    I was wondering if you ever found a solution. If you did, I would love to see it.

  3. #3
    Join Date
    Aug 2003
    In my house
    Here, try this.
    	<script type="text/javascript">
    		var pics = [
    			['linkurl', 'imgurl'],
    			['linkurl', 'imgurl'],
    			['linkurle', 'imgurl'],
    		function randImg(arr_len) {
    			var str = '';
    			var rand_num = Math.round(Math.random() * (pics.len - 1));
    			if(typeof pics[rand_num] == 'object') {
    				str += '<a href="' + pics[rand_num][0] + '"><img src="' + pics[rand_num][1] + '"></a>';
    			else {
    				str += '<img src="' + pics[rand_num] + '">';
    			return str;
    Place the following line where you want the random image to load:
    <script type="text/javascript">document.write(randImg());</script>
    The script can be modified so you don't need that line; just an empty element to act as a container.
    Last edited by Paul Jr; 09-21-2004 at 06:57 PM.
    Thousand different paths
    So many sterile ends
    I chose the Devil's path

    Never shall the sun kiss my face
    And caress me with it's burning light
    For I dwell in the shadows
    And sleep side by side with death

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center