script for onload a new image appears?

Discussion in 'HTML' started by ross, Nov 5, 2003.

  1. ross

    ross Guest

    I am looking for a script that will make a new image appear on page when
    refresh or reload appears. Here is an example of such a page
    http://www.vanderbilt.edu/
    Thanks, I really appreciate this newsgroup. Dick Ross




    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
     
    ross, Nov 5, 2003
    #1
    1. Advertising

  2. ross

    J Briggs Guest

    On Wed, 5 Nov 2003 10:14:39 -0600, "ross" <> wrote:

    >I am looking for a script that will make a new image appear on page when
    >refresh or reload appears. Here is an example of such a page
    >http://www.vanderbilt.edu/
    >Thanks, I really appreciate this newsgroup. Dick Ross
    >


    This will use client-side processing to obtain a random picture.

    To begin with, make a folder in your webpage folder (eg "pics") and
    the possible pictures you want in there, naming them pic01.jpg,
    pic02.jpg, pic03.jpg etc. The script assumes that you are using *.jpg
    format for your pictures.

    <script language="JavaScript">
    function ChooseImage() {
    var pics="10"; //REPLACE THIS WITH THE NO OF PICS YOU HAVE
    var num;
    var path;
    num = Math.round(Math.random() * pics) + 1;
    path = "pics/pic" + num + ".jpg"
    document.write('<img src="' + path + '" name="Picture "' + num
    + '">');
    }
    </script>

    Then put this where you want to put the image:

    <script language="JavaScript">
    ChooseImage;
    </script>


    Jonathan.
     
    J Briggs, Nov 5, 2003
    #2
    1. Advertising

  3. ross

    ross Guest

    So the first <script > goes into the header and the second <script> goes
    into the body ("where youwant to put the image")? I thank you for your help.
    Dick

    "J Briggs" <> wrote in message
    news:...
    > On Wed, 5 Nov 2003 10:14:39 -0600, "ross" <> wrote:
    >
    > >I am looking for a script that will make a new image appear on page when
    > >refresh or reload appears. Here is an example of such a page
    > >http://www.vanderbilt.edu/
    > >Thanks, I really appreciate this newsgroup. Dick Ross
    > >

    >
    > This will use client-side processing to obtain a random picture.
    >
    > To begin with, make a folder in your webpage folder (eg "pics") and
    > the possible pictures you want in there, naming them pic01.jpg,
    > pic02.jpg, pic03.jpg etc. The script assumes that you are using *.jpg
    > format for your pictures.
    >
    > <script language="JavaScript">
    > function ChooseImage() {
    > var pics="10"; //REPLACE THIS WITH THE NO OF PICS YOU HAVE
    > var num;
    > var path;
    > num = Math.round(Math.random() * pics) + 1;
    > path = "pics/pic" + num + ".jpg"
    > document.write('<img src="' + path + '" name="Picture "' + num
    > + '">');
    > }
    > </script>
    >
    > Then put this where you want to put the image:
    >
    > <script language="JavaScript">
    > ChooseImage;
    > </script>
    >
    >
    > Jonathan.
    >





    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
     
    ross, Nov 5, 2003
    #3
  4. ross

    J Briggs Guest

    On Wed, 5 Nov 2003 13:32:06 -0600, "ross" <> wrote:

    >So the first <script > goes into the header and the second <script> goes
    >into the body ("where youwant to put the image")?


    Yes, that's right. The second script goes where ever you want the
    random image to appear in the body.
     
    J Briggs, Nov 5, 2003
    #4
  5. ross

    ross Guest

    I really thank you, but I guess the ludite in me is standing in the way of
    understanding this. Thanks anyway, I appreciate your time. Dick Ross
    www.rosmd.com

    "J Briggs" <> wrote in message
    news:...
    > On Wed, 5 Nov 2003 13:32:06 -0600, "ross" <> wrote:
    >
    > >So the first <script > goes into the header and the second <script> goes
    > >into the body ("where youwant to put the image")?

    >
    > Yes, that's right. The second script goes where ever you want the
    > random image to appear in the body.





    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
     
    ross, Nov 5, 2003
    #5
  6. ross

    Mark Parnell Guest

    Sometime around Wed, 05 Nov 2003 17:35:15 +0000, J Briggs is reported to
    have stated:
    >
    > This will use client-side processing to obtain a random picture.

    <snip>
    > Then put this where you want to put the image:


    ....and realise that you should have done it with a server-side script,
    because ~15% of your visitors won't see the images at all. :)

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
     
    Mark Parnell, Nov 5, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fabio R.
    Replies:
    0
    Views:
    803
    Fabio R.
    Mar 25, 2005
  2. Replies:
    7
    Views:
    542
    dorayme
    Sep 11, 2006
  3. David Otton

    window.onload and body.onload differences

    David Otton, Nov 4, 2004, in forum: Javascript
    Replies:
    2
    Views:
    559
    Martin Honnen
    Nov 4, 2004
  4. Replies:
    5
    Views:
    264
    Thomas 'PointedEars' Lahn
    May 15, 2005
  5. marco

    onload -->* no onload

    marco, Jun 22, 2006, in forum: Javascript
    Replies:
    7
    Views:
    207
    marco
    Jun 24, 2006
Loading...

Share This Page