Results 1 to 4 of 4

Thread: How can I get HTML/CSS to display a randomly selected image?

  1. #1

    How can I get HTML/CSS to display a randomly selected image?

    Hi guys,

    I'm using Dreamweaver MX 2004 to create an HTML website.

    I have a series of header images in a folder all with the same dimensions. What I want to be able to do is have one of these images, selected at random, to appear in a certain place everytime a new page is loaded.

    From what I know, I believe this may be possible using CSS?

    Any help would be much appreciated. Thank you very much and I hope to hear from you.

    All the best,

    Mark

  2. #2
    you need to either use something server-side like php or asp, or something client-side like javascript. css and html alone won't do it.

  3. #3
    using javascript I would place the images in an array and then randomly select one from the array

    try here for help
    http://www.w3schools.com/js/default.asp

    but it can't be done with just CSS, using Javascript though does make it DHTML so if you know HTML & CSS, learn javascript and it means you can add DHTML to your CV...2 for 1
    now with blog, click here

  4. #4
    that's brilliant!

    thanks guys - much appreciated.

    all the best,

    mark

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
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012