Closed Thread Icon

Topic awaiting preservation: Can i use javascript to load a diff. image everytime the page is loaded or refreshed? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8830" title="Pages that link to Topic awaiting preservation: Can i use javascript to load a diff. image everytime the page is loaded or refreshed? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Can i use javascript to load a diff. image everytime the page is loaded or refreshed? <span class="small">(Page 1 of 1)</span>\

 
EvilEgg
Nervous Wreck (II) Inmate

From:
Insane since: Aug 2003

posted posted 08-22-2003 23:19

Can i use javascript to load a diff. image everytime the page is loaded or refreshed? And is it possible to do this with a script that works in IE5, IE6, NS4, NS6.

Thanks in advance for any replies!

Thomas S. aka EvilEgg

P.S. Great PS tutorials on the main site!

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 08-22-2003 23:28

Use the search Luke, use the search!

Go to: http://www.ozoneasylum.com/Forum2/HTML/002253.html


EvilEgg
Nervous Wreck (II) Inmate

From:
Insane since: Aug 2003

posted posted 08-23-2003 05:17

Thanks for the link!

But is it possible to have the image load in order, not random, meaning, loat 1.jpg, next guy comes along, load 2.jpg and so on and so on

thx

Thomas S.

EvilEgg
Nervous Wreck (II) Inmate

From:
Insane since: Aug 2003

posted posted 08-23-2003 05:23

With the little knowlege i have of javascript i asume that this part goes into the <HEAD> tags

code:
<script type="text/javascript"><!--DocOzone's Javascript code, copyright 2000//  Feel free to borrow and modify this code,//  but be sure to leave this credit in the source!//  Your pal,   -Dr. Thaddeus Ozone-//          [url=http://www.ozones.com/]http://www.ozones.com/[/url]  // start random logo scriptlogonames = new Array ("gurus_logo_ozone2.jpeg","gurus_logo_ozone.jpeg","gurus_logo_ozone4.gif");rando = Math.round( Math.random() * (logonames.length - 1) )logoname = logonames[rando];document.write('<img src="http://gurusnetwork.com/images/logos/'+logoname+'" width="360" height="128" border="0" />');//--></script>



But how to i call it up in the actual webpage?

I know thats a really beginners question, but hey, why hide it.

Thanks
Thomas S.


EvilEgg
Nervous Wreck (II) Inmate

From:
Insane since: Aug 2003

posted posted 08-23-2003 05:28

Sorry, same script, but easier to read

code:
<script type="text/javascript">
<!--DocOzone's Javascript code, copyright 2000
// Feel free to borrow and modify this code,
// but be sure to leave this credit in the source!
// Your pal, -Dr. Thaddeus Ozone-
// [url=http://www.ozones.com/]http://www.ozones.com/[/url]
// start random logo script
logonames = new Array (
"gurus_logo_ozone2.jpeg",
"gurus_logo_ozone.jpeg",
"gurus_logo_ozone4.gif"
);
rando = Math.round( Math.random() * (logonames.length - 1) )
logoname = logonames[rando];
document.write('<img src="http://gurusnetwork.com/images/logos/'+logoname+'" width="360" height="128" border="0" />');
//-->
</script>



Thats better


poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 08-23-2003 06:17

Use the Edit/Delete button Luke. Use the Edit/Delete button.

And to answer your question about the position of the script. Put it where you want your random picture. If that's on top of the page, the HEAD is appropriate.

Cheers,

Mathieu "POÏ" HENRI

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 08-23-2003 10:11

EvilEgg,

Showing images in specific order is not possible with JavaScript since it is a client-side language (visitor2 can't know what image was displayed to visitor1). This can only be done with some server side scripting (in PHP, for example).

As far as script placement is concerned, as Poi said, just put it where you want random image to appear. But, you shouldn't put it in <HEAD> section, since there should be no image tags there. Put it anywhere inside <BODY> tag...


poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 08-23-2003 10:21

mr.maX: woops. As you said putting an IMG in the HEAD is ugly and IE nor Fb do bypass that method. But I haven't tried to set a DTD to see how behaves Fb.

++

Mathieu "POÏ" HENRI

[This message has been edited by poi (edited 08-23-2003).]

« BackwardsOnwards »

Show Forum Drop Down Menu