Dzieci OnLine

Webdesign Grafika Pomoc - zmieniające się zdjęcia

Anonymous - Wto 19 Paź, 2004 15:03
Temat postu: zmieniające się zdjęcia
Witam!

Czy ktoś wie jak można zrobić żeby w jednym miejscu pojawiały się np. 4 zdjęcia- zmieniające się ciągle? Podobno jest do tego jakiś program...Byłabym wdzięczna za odpowiedź.
Dexter - Pią 22 Paź, 2004 00:11
Temat postu:
Mam skrypt na losowe zdjęcia ale tylko na jedno

Kod:
 <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
    // JavaScript to interpolate random images into a page.
    var ic = 7;                     // Number of alternative images
    var xoxo = new Array(ic);          // Array to hold filenames
    // Set up the images. These are GIFs, but they don't have to be.
    // You could also save space in your file by including the
    // unchanging part of the image filename (i.e. 'inline/imageSample'
    // and '.gif') in the 'writeln' statement below, and just storing
    // the part of the image name that actually changes. Used this way
    // you could reference a very large number of different images while
    // keeping the file size small.
xoxo[0] = "tree.jpg";
xoxo[1] = "foto2.jpg";
xoxo[2] = "chmury.jpg";
xoxo[3] = "kwiatek.jpg";
xoxo[4] = "sun.jpg";
xoxo[5] = "rainbow.jpg";
xoxo[6] = "horizont.jpg";
    // pickRandom - Return a random number in a given range. If we're running
    // on an older browser that doesn't support 'Math.random()', we can fake
    // it by using the current time. This isn't ideal for mission-critical
    // security applications, but it's fine here. Note that we divide the
    // current time by 1000 to get rid of the milliseconds which Navigator
    // doesn't seem to take into account.
function pickRandom(range) {
if (Math.random)
return Math.round(Math.random() * (range-1));
else {
var now = new Date();
return (now.getTime() / 1000) % range;
}
}
// Write out an IMG tag, using a randomly-chosen image name.
var choice = pickRandom(ic);
// -->
        </SCRIPT>



Ten fragment wstaw w miejscu w którym mają się pojawiać zdjęcia

Kod:
<SCRIPT LANGUAGE="JavaScript">document.writeln(''+'<IMG SRC="'+xoxo[choice]+'"'+'');</SCRIPT>


W tym fragmencie pierwszego kodu (tak jak na dole) musisz pozmieniać ścieżki do swoich obrazków
Kod:

(...)
xoxo[0] = "tree.jpg";
xoxo[1] = "foto2.jpg";
xoxo[2] = "chmury.jpg";
xoxo[3] = "kwiatek.jpg";
xoxo[4] = "sun.jpg";
xoxo[5] = "rainbow.jpg";
xoxo[6] = "horizont.jpg";
(...)

adam(o)_1991 - Wto 30 Lis, 2004 09:42
Temat postu:
heh niezły skypt,ale na moje oko pierwszy lepszy lamer nie będzie wiedział jak to wstawiać.
Powiem ci tyle:
Sciagnij se Coffe Cup GIf animator ,w tym programie dajesz jakies 4 zdjęcia i się cały czas zmieniają.
Dexter - Wto 30 Lis, 2004 13:46
Temat postu:
A sam wciskasz tzw. „lamom” CSS’a

2.0 Powered by phpBB modified v1.9 by Przemo © 2003 phpBB Group