![]() |
Leider bin ich ein HTML-DAU, deswegen wende ich mich vertrauensvoll an unser Forum.
Ich möchte bei jeden Seitenaufruf ein Bild, aus einem "Pool" an Bildern, zufällig laden. Bitte postet den Qellcode. *hilfesuchenddreinblickend* |
<SCRIPT LANGUAGE="JavaScript"><!--
// the number of pictures to choose from var NumberOfPictures = 3 // creat the array var pict = new BuildArray(NumberOfPictures); // the information for the pictures // replace the [...] with your information pict[1] = "[img 1 src]/" WIDTH=/"[img 1 width]/" HEIGHT=/"[img 1 height]/"" pict[1] = "[img 2 src]/" WIDTH=/"[img 2 width]/" HEIGHT=/"[img 2 height]/"" pict[1] = "[img 3 src]/" WIDTH=/"[img 3 width]/" HEIGHT=/"[img 3 height]/"" /* ....more picture information goes here.... */ // a function used to build arrays function BuildArray(size){ this.length = size for (var i = 1; i <= size; i++){ this[i] = null} return this } // choose the picture var d = new Date() var secs = d.getSeconds() var rnd = (secs % pict.length) + 1 // desplay the new picture with (document){ // start a new paragraph [optional] write("<P ALIGN=/"CENTER/">"); // desplay the picture write("<IMG SRC=/""+pict[rnd]+"ALT=/"/">"); // close the paragraph [optional] write("</P>"); // --></SCRIPT> gruss, snowman |
Ah, danke - werds mal ausprobieren und dann das Erfolgserlebnis posten :)
|
Irgend etwas check ich nicht...
IE gibt einen Fehler an und erwartet einen ; in der Zeile 27 - ist eigentlich ein Blödsinn da in der Zeile 27 nur der Kommentar steht: // replace the [...] with your information Opera meldet zwar keinen Fehler zeigt aber auch nix an... Ich habe nur die Bidler eingetragen... pict[1] = "0max.gif/" WIDTH=/"200/" HEIGHT=/"400/"" pict[1] = "0max2.gif/" WIDTH=/"200/" HEIGHT=/"400/"" pict[1] = "0max3.jpg/" WIDTH=/"200/" HEIGHT=/"400/"" sollte "pict[1]" nicht fortlaufend sein? Gehört da auch irgend eine Zuweisung rein? write("<IMG SRC=/""+pict[rnd]+"ALT=/"/">"); // close the paragraph [optional] write("</P>"); |
würde ich auch sagen, habe das script nur runtergeladen, ohne es zu testen. ;-) wenns nicht funktioniert, such dir über eine suchmaschine ein neues. (zB random image javascript)
gruss, snowman |
|
ok, dann sich ich halt...
|
naja, ganz ohne trial and error wirds nicht gehen (siehe neues forum ;-)
gruss, snowman |
ROFL - ja aber es hat sich doch gelohnt - Das Neue bietet viel mehr Möglichkeiten und ist schneller.
|
naja, eben das meinte ich. reinhängen zahlt sich halt aus. ;-)
gruss, snowman |
Alle Zeitangaben in WEZ +2. Es ist jetzt 13:51 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag