document.writeln - js ?

Out of context: Reply #3

  • Started
  • Last post
  • 6 Responses
  • xrusos0

    i know that kpl... but for some reason, since the call tag won't let it work that way.

    here's the script as i have in the head tag...

    // JavaScript to interpolate random images into a page.
    var ic = 11; // Number of alternative images
    var xoxo = new Array(ic); // Array to hold filenames

    xoxo[0] = "/images/highlanders.jpg";
    xoxo[1] = "/images/car.jpg";
    xoxo[2] = "/images/broken_dock.jpg";
    xoxo[3] = "/images/lighthouse.jpg";
    xoxo[4] = "/images/bird.jpg";
    xoxo[5] = "/images/red_barn.jpg";
    xoxo[6] = "/images/deck.jpg";
    xoxo[7] = "/images/fog.jpg";
    xoxo[8] = "/images/subway.jpg";
    xoxo[9] = "/images/highlanders.jpg";
    xoxo[10] = "/images/highlanders.jpg";

    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);

View thread