Re: nahodne pozadi

From: Paco (paco@seznam.cz)
Date: 16. 06. 2002, 21:55 CEST


>jde nejak udelat, aby se menil nahodne, po nacteni stranky, obrazek na
>pozadi? a nesel by nahodne menit i treba externi .css soubor? dik
>(o)step

Samozrejme, ze to jde nejak udelat - PHP. Zde pouze zakladni princip:

/*
<!--
bkg[]='./pix/img_0.jpg';
bkg[]='./pix/img_1.jpg';
# ....
bkg[]='./pix/img_n.jpg';
#
css[]='./sty/style_0.css';
css[]='./sty/style_1.css';
# ....
css[]='./sty/style_n.css';
# kratsi by bylo filenames pixu a/nebo css nacist cyklem, jsou-li v rade
$b=count($bkg)-1; $c=count($css)-1;
srand((double)microtime()*1e6);
# a pak
<style ....>
@import url(<?echo $css[rand(0,$c)];?>);
# a/nebo
body{background-image:url(<?echo $bkg[rand(0,$b)];?>);background-repeat:repeat-y;}
</style>
# a/nebo
<body ......... background=<?echo $bkg[rand(0,$b)];?>>
-->
*/

pako Paco. 


______________________________________________________________________
Reklama:
WWW stranky zdarma na http://www.sweb.cz



This archive was generated by hypermail 2.1.2 : 16. 06. 2002, 21:55 CEST