Results 1 to 4 of 4

Thread: Random Image Load

  1. #1
    Join Date
    Mar 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Random Image Load

    Hi, Can you help at all please.
    I am looking for a script whereby a new client testimonial will load into the page each time the page is opened.
    It doesn't need to tween between other testimonials it just m=needs to load a new random message each time.

    Many thanks in advance.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    PHP:
    Code:
    <?php
    $message = array("Welcome to my site!", "Hello World.", "Wassup?");
    echo $message[rand(0, count($message)-1)];
    ?>
    JS:
    Code:
    <script type="text/javascript">
    var messages = ["Welcome to my site!", "Hello World.", "Wassup?"];
    alert(messages[Math.floor(Math.random()*messages.length)]);
    </script>
    Jeremy | jfein.net

  3. #3
    Join Date
    Mar 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, but not quite what I had in mind.

    The random message will actually be within the website screen itslef and will be a testimonial. Probably as a image.

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    So use the php one. Or does your server not support PHP?
    Jeremy | jfein.net

Bookmarks

Posting Permissions

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