1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

rotating image help

Discussion in 'JavaScript' started by drew68, Aug 12, 2006.

  1. #1
    hey guys...i'm completely stumped. i've done this before and was successful but for some reason this is not happening. i THINK i may know why but was hoping someone could shed some light on this...

    http://www.studio9designs.org/brian/duratuff/index.html

    i'm trying to make the main big image rotate as i have 7 main pics.

    i've placed javascript below the </head> and above the <body>

    and the image reference code next to the main 1st image called mainpic1.jpg.


    here's how i have it...


    </head>

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    // The Array Function
    function makeArray(len) {
    for (var i = 0; i < len; i++) this = null;
    this.length = len;
    }
    // This is where the array of text/images/sounds is created.
    images = new makeArray(4);
    images[0] = "<img src='http://studio9designs.org/brian/duratuff/mainpic1.jpg' border='0'>";
    images[1] = "<img src='http://studio9designs.org/brian/duratuff/mainpic2.jpg' border='0'>";
    images[2] = "<img src='http://studio9designs.org/brian/duratuff/mainpic3.jpg' border='0'>";
    images[3] = "<img src='http://studio9designs.org/brian/duratuff/mainpic4.jpg' border='0'>";
    // The random number generator.
    function rand(n) {
    seed = (0x015a4e35 * seed) % 0x7fffffff;
    return (seed >> 16) % n;
    }
    // -->
    </SCRIPT>

    <body bgcolor="FFFFFF" marginheight="0" marginwidth="0" leftmargin="0" rightmargin="0" bottommargin="0">



    ...and the right by the image i have...


    <td colspan="3">

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    bName = navigator.appName;bVer = parseInt(navigator.appVersion);
    if ((bName == "Netscape" && bVer >= 3) ||
    (bName == "Microsoft Internet Explorer" && bVer >= 3)) br = "n3";
    else br = "n2";
    // Where you place this is where the random object will be displayed.
    if (br == "n3") {
    document.write(images[rand(images.length)])
    }
    else {
    document.write("<img src='http://studio9designs.org/brian/duratuff/mainpic1.jpg' border='0'>");
    }
    // -->
    </SCRIPT><img src="http://studio9designs.org/brian/duratuff/mainpic1.jpg" width="557" height="240">


    </td></tr>



    where am i going wrong here? i'm thinking ... is it because of adsense/google ads that the page is NOT refreshing??

    thanks -

    drew
     
    drew68, Aug 12, 2006 IP
  2. Jen-

    Jen- Peon

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Do you want the images to rotate randomly or would you like to have some that rotate more than others? Also do you want them to rotate when the page reloads?
     
    Jen-, Aug 12, 2006 IP
  3. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Place your first chunk of javascript *within* the head tags.
     
    exam, Aug 12, 2006 IP
    GRIM likes this.
  4. drew68

    drew68 Well-Known Member

    Messages:
    582
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #4
    thanks guys...initially that was my first mistake but all i was missing was the rollover code in the 'body' tag...lol that's all i was missing

    but thanks guys..i got it up :)
     
    drew68, Aug 12, 2006 IP
  5. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Glad you got it sorted. :)
     
    exam, Aug 12, 2006 IP