Script Natalizi

« Older   Newer »
  Share  
H e r o
view post Posted on 13/3/2009, 16:18




Script Natalizi




Effetto neve (media) (fiocco)
CODICE
<!-- Prelevato nel Forum di Supporto di ForumFree.net e ForumCommunity.net  -->
<!--webbot bot=HTMLMarkup startspan -->
<script type="text/javascript" language="JavaScript1.2">   //Configure below to change URL path to the snow image
var snowsrc="http://image.forumfree.it/3/4/2/3/3/6/4/1225536874.png"
// Configure below to change number of snow to render
var no = 10;

var ns4up = (document.layers) ? 1 : 0;  // browser sniffer
var ie4up = (document.all) ? 1 : 0;

var dx, xp, yp;    // coordinate and position variables
var am, stx, sty;  // amplitude and step variables
var i, doc_width = 800, doc_height = 600;

if (ns4up) {
 doc_width = self.innerWidth;
 doc_height = self.innerHeight;
} else if (ie4up) {
 doc_width = document.body.clientWidth;
 doc_height = document.body.clientHeight;
}

dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();

for (i = 0; i < no; ++ i) {  
 dx[i] = 0;                        // set coordinate variables
 xp[i] = Math.random()*(doc_width-50);  // set position variables
 yp[i] = Math.random()*doc_height;
 am[i] = Math.random()*20;         // set amplitude variables
 stx[i] = 0.02 + Math.random()/10; // set step variables
 sty[i] = 0.7 + Math.random();     // set step variables
 if (ns4up) {                      // set layers
   if (i == 0) {
     document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><a href=\"http://dynamicdrive.com/\"><img src='"+snowsrc+"' border=\"0\"></a></layer>");
   } else {
     document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"></layer>");
   }
 } else if (ie4up) {
   if (i == 0) {
     document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"></a></div>");
   } else {
     document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"></div>");
   }
 }
}

function snowNS() {  // Netscape main animation function
 for (i = 0; i < no; ++ i) {  // iterate for every dot
   yp[i] += sty[i];
   if (yp[i] > doc_height-50) {
     xp[i] = Math.random()*(doc_width-am[i]-30);
     yp[i] = 0;
     stx[i] = 0.02 + Math.random()/10;
     sty[i] = 0.7 + Math.random();
     doc_width = self.innerWidth;
     doc_height = self.innerHeight;
   }
   dx[i] += stx[i];
   document.layers["dot"+i].top = yp[i];
   document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
 }
 setTimeout("snowNS()", 10);
}

function snowIE() {  // IE main animation function
 for (i = 0; i < no; ++ i) {  // iterate for every dot
   yp[i] += sty[i];
   if (yp[i] > doc_height-50) {
     xp[i] = Math.random()*(doc_width-am[i]-30);
     yp[i] = 0;
     stx[i] = 0.02 + Math.random()/10;
     sty[i] = 0.7 + Math.random();
     doc_width = document.body.clientWidth;
     doc_height = document.body.clientHeight;
   }
   dx[i] += stx[i];
   document.all["dot"+i].style.pixelTop = yp[i];
   document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
 }
 setTimeout("snowIE()", 10);
}

if (ns4up) {
 snowNS();
} else if (ie4up) {
 snowIE();
}

/* prelevato su [URL=http://www.grafikat.it]http://www.grafikat.it[/URL] */  

</script><!--webbot bot="HTMLMarkup" endspan -->





Effetto neve (grossa) (fiocco)

CODICE
<!-- Prelevato nel Forum di Supporto di ForumFree.net e ForumCommunity.net  -->
<script type="text/javascript"> <!--
var no = 15;
var speed = 2;
var snowflake = "http://image.forumfree.it/3/4/2/3/3/6/4/1225536750.png";

var ns4up = (document.layers) ? 1 : 0;  
var ie4up = (document.all) ? 1 : 0;
var dx, xp, yp;    
var am, stx, sty;
var i, doc_width = 800, doc_height = 600;
if (ns4up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
} else if (ie4up) {
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
for (i = 0; i < no; ++ i) {  
dx[i] = 0;                      
xp[i] = Math.random()*(doc_width-50);  
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*20;        
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();    
if (ns4up) {                    
if (i == 0) {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
document.write("top=\"15\" visibility=\"show\"><img src=\"");
document.write(snowflake + "\" border=\"0\"></layer>");
} else {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
document.write("top=\"15\" visibility=\"show\"><img src=\"");
document.write(snowflake + "\" border=\"0\"></layer>");
}
} else if (ie4up) {
if (i == 0) {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
document.write(snowflake + "\" border=\"0\"></div>");
} else {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
document.write(snowflake + "\" border=\"0\"></div>");
   }
}
}
function snowNS() {
for (i = 0; i < no; ++ i) {
yp[i] += sty[i];
if (yp[i] > doc_height-50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width = self.innerWidth;
doc_height = self.innerHeight;
}
dx[i] += stx[i];
document.layers["dot"+i].top = yp[i];
document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("snowNS()", speed);
}
function snowIE() {  
for (i = 0; i < no; ++ i) {  
yp[i] += sty[i];
if (yp[i] > doc_height-50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
dx[i] += stx[i];
document.all["dot"+i].style.pixelTop = yp[i];
document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("snowIE()", speed);
}
if (ns4up) {
snowNS();
} else if (ie4up) {
snowIE();
}
// -->
</script>





Effetto palline natalizie in salita

CODICE
<!-- Prelevato nel Forum di Supporto di ForumFree.net e ForumCommunity.net -->
<script type="text/javascript" language="JavaScript1.2">
<!-- Begin
var no = 9; // image number or falling rate
var speed = 20; // the lower the number the faster the image moves
var snow = new Array();
snow[0] = "http://skin.forumfree.net/christmas/christmasball1.gif"
snow[1] = "http://skin.forumfree.net/christmas/christmasball2.gif"
snow[2] = "http://skin.forumfree.net/christmas/christmasball3.gif"
snow[3] = "http://skin.forumfree.net/christmas/christmasball4.gif"
snow[4] = "http://skin.forumfree.net/christmas/christmasball5.gif"
var ns4up = (document.layers) ? 1 : 0; // browser sniffer
var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
var dx, xp, yp; // coordinate and position variables
var am, stx, sty; // amplitude and step variables
var i, doc_width = 800, doc_height = 1800;

if (ns4up||ns6up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
} else if (ie4up) {
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}

dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
j = 0;

for (i = 0; i < no; ++ i) {
dx[i] = 0; // set coordinate variables
xp[i] = Math.random()*(doc_width-50); // set position variables
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*20; // set amplitude variables
stx[i] = 0.02 + Math.random()/10; // set step variables
sty[i] = 0.7 + Math.random(); // set step variables
if (ns4up) { // set layers
if (i == 0) {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\" border=\"0\"></layer>");
} else {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\" border=\"0\"></layer>");
} } else if (ie4up||ns6up) { if (i == 0)
{
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>");
} else {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>");
}
}
if (j == (snow.length-1)) { j = 0; } else { j += 1; }
}

function snowNS() { // Netscape main animation function
for (i = 0; i < no; ++ i) { // iterate for every dot
yp[i] -= sty[i]; if (yp[i] < -50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = doc_height;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width = self.innerWidth;
doc_height = self.innerHeight; }
dx[i] += stx[i];
document.layers["dot"+i].top = yp[i]+pageYOffset;
document.layers["dot"+i].left = xp[i] +
am[i]*Math.sin(dx[i]);
}
setTimeout("snowNS()", speed);
}

function snowIE_NS6() { // IE main animation function
for (i = 0; i < no; ++ i) { // iterate for every dot
yp[i] -= sty[i];
if (yp[i] < -50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = doc_height;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width = ns6up?window.innerWidth-5:document.body.clientWidth;
doc_height = ns6up?window.innerHeight-5:document.body.clientHeight;
}
dx[i] += stx[i];
if (ie4up){
document.all["dot"+i].style.pixelTop = yp[i]+document.body.scrollTop;
document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
}
else if (ns6up){
document.getElementById("dot"+i).style.top=yp[i]+pageYOffset;
document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i]);
}
}
setTimeout("snowIE_NS6()", speed);
}

if (ns4up) {
snowNS();
} else if (ie4up||ns6up) {
snowIE_NS6();
}
// End -->

</script>




Quanti giorni mancano a Natale?

CODICE
<!-- Prelevato nel Forum di Supporto di ForumFree.net e ForumCommunity.net  -->
<script type="text/javascript">
//funzione che mostra un commento in base al periodo dell'anno in corso.
//si possono cambiare i commenti modificando il testo tra le virgolette (tenendo i tag <p>)
//si possono modificare le date di apparizione di un commento modificando solo i numeri dopo la parola mese  
function calcmes() {
if (mese>0 && mese<5) {
document.write("<p><p>Non è un po' presto per pensare al Natale?")
}
if (mese>=5 && mese<9) {
document.write("<p><p>Non sarebbe meglio pensare all'estate?")
}
if (mese>=9 && mese<=12) {
document.write("<p><p>Non manca molto...")
}
}

//funzione di conversione dei giorni della settimana da numeri in lettere
function convgio() {
if (gset==0) { gset="domenica" }
if (gset==1) { gset="lunedi" }
if (gset==2) { gset="martedi" }
if (gset==3) { gset="mercoledi" }
if (gset==4) { gset="giovedi" }
if (gset==5) { gset="venerdi" }
if (gset==6) { gset="sabato" }
}

//funzione di conversione dei mesi dell'anno da numeri in lettere
function convmes() {
if (mese==0) { mese="gennaio" }
if (mese==1) { mese="febbraio" }
if (mese==2) { mese="marzo" }
if (mese==3) { mese="aprile" }
if (mese==4) { mese="maggio" }
if (mese==5) { mese="giugno" }
if (mese==6) { mese="luglio" }
if (mese==7) { mese="agosto" }
if (mese==8) { mese="settembre" }
if (mese==9) { mese="ottobre" }
if (mese==10) { mese="novembre" }
if (mese==11) { mese="dicembre" }

}

//funzione per il calcolo della data odierna
function dataoggi() {
oggi=new Date()
gset=oggi.getDay()
gmes=oggi.getDate()
mese=oggi.getMonth()
anno=oggi.getYear()
}

//funzione per il calcolo dei giorni mancanti a Natale
//per cambiare ricorrenza modificare il mese e il giorno del campo natale (formato inglese)
function natale() {
oggi=new Date()
natale=new Date("12/25/"+ anno)
giornims=natale.getTime() - oggi.getTime()
giorni=Math.floor(giornims / (1000 * 60 * 60 * 24))
return giorni
}

</script>
<script type="text/javascript">
//il testo all'interno delle virgolette e' modificabile (tranne i tag <h2> e </h2>)
document.write("<h2>NATALE</h2>")

//chiamata alla funzione che definisce l'oggetto data
dataoggi()


//chiamata alla funzione del commento
calcmes()

//chiamate alle funzioni di conversione dei numeri della data in testo
convmes()
convgio()

//visualizzazione della data odierna
document.write("<p><p>Oggi è " + gset + " " + gmes + " " + mese + " " + anno)

//visualizzazione dei giorni mancanti al prossimo Natale (o altra ricorrenza)
//il testo all'interno delle virgolette e' modificabile (tranne il richiamo +natale()+)
document.write(" e mancano " + natale() + " giorni a Natale")
</script>


 
Top
0 replies since 13/3/2009, 16:18   175 views
  Share