Skip to main content

Changing background images 55 Responses

Last post: 3 months, 3 weeks ago | Thread started: Jul 28, 08, 2:53 a.m.

RespondNew TopicDisable Images

  • honest

    Hi folks, annoying print designer here with a silly web question on behalf of my wife (Japanese) who is teaching herself web development:

    She wants to be able to have different background images loading on each visitation on a homepage.
    How best to apply simple code for this? Is this that CSS magic that I keep hearing of or the powerful flash-killer that is Javascript?

    Jul 28, 08, 2:53 a.m. – Permalink
  • omgitsacamera

    Javascript

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earJul 28, 08, 2:55 a.m. – Permalink
  • Stugoo

    put the background image in using inline css.
    then use a javascript function to pic an image at random.

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earJul 28, 08, 2:57 a.m. – Permalink
  • PSYKHO

    This works:

    <SCRIPT LANGUAGE="Javascript"><!-- function bkgrnd() {} ; bg = new bkgrnd () ; n = 0 bg[n++] = "images/Image1.gif" bg[n++] = "images/Image2.gif" bg[n++] = "images/Image3.gif" bg[n++] = "images/Image4.gif" bg[n++] = "images/Image5.gif" //Just keep adding rnd = Math.floor(Math.random() * n) ; tmp = '<BODY BACKGROUND="' +bg[rnd]+ '"' +' BGCOLOR="#FFFFFF">' //--></SCRIPT></HEAD> <SCRIPT LANGUAGE="Javascript"><!-- document.write( tmp ) //--></SCRIPT>

    • Forgot to remove the end header tag: </HEAD> works non the less.PSYKHO
    + add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earJul 28, 08, 2:59 a.m. – Permalink
  • VectorMasked

    what they said ^^^

    Because is she was german, the method would be different; and if she was Portuguese it could simply not be done.

    ;o)

    + add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earJul 28, 08, 3:02 a.m. – Permalink
  • honest

    Well, never mind the Spanish Inquisition then I guess…

    Many thanks folks.

    • Nobody expects the spanish inquisition!!Stugoo1/2
      exactly, wasn't hoping people would have thinking caps on this early on a sunny mondayhonest2/2
    next note >+ add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earJul 28, 08, 3:08 a.m. – Permalink

Login or Register to respond to this

Skip to main content