Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > script for onload a new image appears?

Reply
Thread Tools

script for onload a new image appears?

 
 
ross
Guest
Posts: n/a
 
      11-05-2003
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! =-----
 
Reply With Quote
 
 
 
 
J Briggs
Guest
Posts: n/a
 
      11-05-2003
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.

 
Reply With Quote
 
 
 
 
ross
Guest
Posts: n/a
 
      11-05-2003
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! =-----
 
Reply With Quote
 
J Briggs
Guest
Posts: n/a
 
      11-05-2003
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.
 
Reply With Quote
 
ross
Guest
Posts: n/a
 
      11-05-2003
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! =-----
 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      11-05-2003
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
onload -->* no onload marco Javascript 7 06-24-2006 08:39 PM
Why doesn't frameset onload event get called when each of the frames has an onload? adnanx82@gmail.com Javascript 5 05-15-2005 01:58 PM
base.OnLoad called, OnLoad not executed Fabio R. ASP .Net 0 03-25-2005 01:21 PM
window.onload and body.onload differences David Otton Javascript 2 11-04-2004 04:34 PM
Image onload handler - how to access the image object? Roger Shrubber Javascript 1 04-21-2004 09:42 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57