how to put Christmas snow

asi

Junior member
  • Aug 30, 2006
    325
    15
    18
    mata website ekakata hima wetena widihata danna puluwan widihak kiyanna koooooooooooooo any script what should i do:rolleyes: :rolleyes: :rolleyes:
     

    Kalindugayan

    Well-known member
  • Nov 8, 2007
    47,111
    1,140
    113
    34
    @ Elakiri.com
    fltofx said:
    hi,
    Follow this tutorial.
    http://www.toxiclab.org/tutorial.asp?ID=283
    If u want explanation on code just tell me i'll explain it.

    Happy flashing.
    Elakiri
    11.gif
     

    MaD-DoC

    Member
    Oct 27, 2007
    6,337
    22
    0
    SLIIT/Malabe
    [FONT=Arial, Helvetica, sans-serif]Make snow fall on your webpage this Christmas! [/FONT]
    [FONT=Arial, Helvetica, sans-serif]Here is a great falling snow javascript that doesn't need images uploaded to your server. It uses font types to make the snowflake images which makes it easier for users to install to their websites. [/FONT]
    [FONT=Arial, Helvetica, sans-serif]It is a one step script which you place into your webpage straight after the <body> tag. [/FONT]
    [FONT=Arial, Helvetica, sans-serif]Configure the variables at the top of the script to set the number of snowflakes, the colors, fonts and speed. Nothing else needs configuring. [/FONT]
    [FONT=Arial, Helvetica, sans-serif]STEP 1:[/FONT]
    [FONT=Arial, Helvetica, sans-serif]Copy and paste the falling snow javascript below after the <body> tag of your html.

    [/FONT]

    PHP:
    <script> 
    // CREDITS: // Snowmaker Copyright (c) 2003 Peter Gehrig. All rights reserved. 
    // Distributed by http://www.hypergurl.com // Permission given to use the script 
    on webpages provided that this notice remains as is. // Set the number of snowflakes 
    (more than 30 - 40 not recommended) var snowmax=35 // Set the colors for the snow. 
    Add as many colors as you like var snowcolor=new Array("#aaaacc","#ddddFF","#ccccDD") 
    // Set the fonts, that create the snowflakes. Add as many fonts as you like var 
    snowtype=new Array("Arial Black","Arial Narrow","Times","Comic 
    Sans MS") // Set the letter that creates your snowflake (recommended:*) var 
    snowletter="*" // Set the speed of sinking (recommended values range 
    from 0.3 to 2) var sinkspeed=0.6 // Set the maximal-size of your snowflaxes var 
    snowmaxsize=22 // Set the minimal-size of your snowflaxes var snowminsize=8 // 
    Set the snowing-zone // Set 1 for all-over-snowing, set 2 for left-side-snowing 
    // Set 3 for center-snowing, set 4 for right-side-snowing var snowingzone=3 /////////////////////////////////////////////////////////////////////////// 
    // CONFIGURATION ENDS HERE /////////////////////////////////////////////////////////////////////////// 
    // Do not edit below this line var snow=new Array() var marginbottom var marginright 
    var timer var i_snow=0 var x_mv=new Array(); var crds=new Array(); var lftrght=new 
    Array(); var browserinfos=navigator.userAgent var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/) 
    var ns6=document.getElementById&&!document.all var opera=browserinfos.match(/Opera/) 
    var browserok=ie5||ns6||opera function randommaker(range) { rand=Math.floor(range*Math.random()) 
    return rand } function initsnow() { if (ie5 || opera) { marginbottom = document.body.clientHeight 
    marginright = document.body.clientWidth } else if (ns6) { marginbottom = window.innerHeight 
    marginright = window.innerWidth } var snowsizerange=snowmaxsize-snowminsize for 
    (i=0;i<=snowmax;i++) { crds[i] = 0; lftrght[i] = Math.random()*15; x_mv[i] 
    = 0.03 + Math.random()/10; snow[i]=document.getElementById("s"+i) snow[i].style.fontFamily=snowtype[randommaker(snowtype.length)] 
    snow[i].size=randommaker(snowsizerange)+snowminsize snow[i].style.fontSize=snow[i].size 
    snow[i].style.color=snowcolor[randommaker(snowcolor.length)] snow[i].sink=sinkspeed*snow[i].size/5 
    if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)} if (snowingzone==2) 
    {snow[i].posx=randommaker(marginright/2-snow[i].size)} if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4} 
    if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2} 
    snow[i].posy=randommaker(2*marginbottom-marginbottom-2*snow[i].size) snow[i].style.left=snow[i].posx 
    snow[i].style.top=snow[i].posy } movesnow() } function movesnow() { for (i=0;i<=snowmax;i++) 
    { crds[i] += x_mv[i]; snow[i].posy+=snow[i].sink snow[i].style.left=snow[i].posx+lftrght[i]*Math.sin(crds[i]); 
    snow[i].style.top=snow[i].posy if (snow[i].posy>=marginbottom-2*snow[i].size 
    || parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){ if (snowingzone==1) 
    {snow[i].posx=randommaker(marginright-snow[i].size)} if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)} 
    if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4} 
    if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2} 
    snow[i].posy=0 } } var timer=setTimeout("movesnow()",50) } for (i=0;i<=snowmax;i++) 
    { document.write("<span id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"'>"+snowletter+"</span>") 
    } if (browserok) { window.onload=initsnow } </script>
     

    MaD-DoC

    Member
    Oct 27, 2007
    6,337
    22
    0
    SLIIT/Malabe
    another script !!

    PHP:
    <script type="text/javascript">
    
    
    // Set the number of snowflakes (more than 30 - 40 not recommended)
    var snowmax=35
    
    // Set the colors for the snow. Add as many colors as you like
    var snowcolor=new Array("#AAAACC","#DDDDFF","#CCCCDD","#F3F3F3","#F0FFFF")
    
    // Set the fonts, that create the snowflakes. Add as many fonts as you like
    var snowtype=new Array("Arial Black","Arial Narrow","Times","Comic Sans MS")
    
    // Set the letter that creates your snowflake (recommended: * )
    var snowletter="*"
    
    // Set the speed of sinking (recommended values range from 0.3 to 2)
    var sinkspeed=0.6
    
    // Set the maximum-size of your snowflakes
    var snowmaxsize=22
    
    // Set the minimal-size of your snowflakes
    var snowminsize=8
    
    // Set the snowing-zone
    // Set 1 for all-over-snowing, set 2 for left-side-snowing 
    // Set 3 for center-snowing, set 4 for right-side-snowing
    var snowingzone=1
    
      /*
       //   * NO CONFIGURATION BELOW HERE *
    */
    
    // Do not edit below this line
    var snow=new Array()
    var marginbottom
    var marginright
    var timer
    var i_snow=0
    var x_mv=new Array();
    var crds=new Array();
    var lftrght=new Array();
    var browserinfos=navigator.userAgent 
    var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
    var ns6=document.getElementById&&!document.all
    var opera=browserinfos.match(/Opera/)  
    var browserok=ie5||ns6||opera
    
    function randommaker(range) {        
        rand=Math.floor(range*Math.random())
        return rand
    }
    
    function initsnow() {
        if (ie5 || opera) {
            marginbottom = document.body.clientHeight
            marginright = document.body.clientWidth
        }
        else if (ns6) {
            marginbottom = window.innerHeight
            marginright = window.innerWidth
        }
        var snowsizerange=snowmaxsize-snowminsize
        for (i=0;i<=snowmax;i++) {
            crds[i] = 0;                      
            lftrght[i] = Math.random()*15;         
            x_mv[i] = 0.03 + Math.random()/10;
            snow[i]=document.getElementById("s"+i)
            snow[i].style.fontFamily=snowtype[randommaker(snowtype.length)]
            snow[i].size=randommaker(snowsizerange)+snowminsize
            snow[i].style.fontSize=snow[i].size
            snow[i].style.color=snowcolor[randommaker(snowcolor.length)]
            snow[i].sink=sinkspeed*snow[i].size/5
            if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)}
            if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)}
            if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
            if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
            snow[i].posy=randommaker(2*marginbottom-marginbottom-2*snow[i].size)
            snow[i].style.left=snow[i].posx
            snow[i].style.top=snow[i].posy
        }
        movesnow()
    }
    
    function movesnow() {
        for (i=0;i<=snowmax;i++) {
            crds[i] += x_mv[i];
            snow[i].posy+=snow[i].sink
            snow[i].style.left=snow[i].posx+lftrght[i]*Math.sin(crds[i]);
            snow[i].style.top=snow[i].posy
            
            if (snow[i].posy>=marginbottom-2*snow[i].size || parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){
                if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)}
                if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)}
                if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
                if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
                snow[i].posy=0
            }
        }
        var timer=setTimeout("movesnow()",50)
    }
    
    for (i=0;i<=snowmax;i++) {
        document.write("<span id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"'>"+snowletter+"</span>")
    }
    if (browserok) {
        window.onload=initsnow
    }
    </SCRIPT>
     

    Billl Gates

    Well-known member
  • May 4, 2008
    11,573
    82
    48
    39
    Pita KOtte
    // Snow Effect Javascript
    // copyright 19th November 2004, 20th July 2006 by Stephen Chapman
    // permission to use this Javascript on your web page is granted
    // provided that all of the code in this script (including these
    // comments) is used without any alteration
    // you can change the number of snow flakes if you like

    var num_flakes = 10;
    var snowflakes = new Array("snowflake.gif","snowflake1.gif");

    // DOM test
    var aDOM = 0, ieDOM = 0, nsDOM = 0; var stdDOM = document.getElementById;
    if (stdDOM) aDOM = 1; else {ieDOM = document.all; if (ieDOM) aDOM = 1; else {
    var nsDOM = ((navigator.appName.indexOf('Netscape') != -1)
    && (parseInt(navigator.appVersion) ==4)); if (nsDOM) aDOM = 1;}}
    function findDOM(objectId, wS) {
    if (stdDOM) return wS ? document.getElementById(objectId).style:
    document.getElementById(objectId);
    if (ieDOM) return wS ? document.all[objectId].style: document.all[objectId];
    if (nsDOM) return document.layers[objectId];
    }

    // window size tests
    function findLivePageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth :700;}function findLivePageHeight() {return window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight :500;}
    function posX() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0;}
    function posY() {return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;}

    // make it snow
    var speed = 50;var movw = new Array();var movh = new Array();var move = new Array();var stepw = new Array();var steph = new Array();var posw = new Array();var posh = new Array();var dir = new Array();var winWidth;var winHeight;
    function startSnow() {winWidth = findLivePageWidth()-75;winHeight = findLivePageHeight()-50;
    for (var i = 0; i < num_flakes; i++){move = 0;movh = 12+ Math.random()*2;movw = 11+ Math.random()*4;posw = Math.random()*(winWidth-35)+12;posh = Math.random()*winHeight; stepw = 0.02 + Math.random()/10;steph = 0.7 + Math.random();dir = (Math.random()>0.5)?1:-1;document.write('<div id="snow'+ i +'" style="position: absolute; z-index: '+ i +'; visibility:hidden; "><img src="'+snowflakes[Math.floor(Math.random()*snowflakes.length)]+ '" border="0"></div>');}setTimeout("moreSnow()", speed);}
    function moreSnow() {for (var i = 0; i < num_flakes; i++) {if (posh > winHeight-50) {posw = 10+ Math.random()*(winWidth-movw-30);posh = 0;dir=(Math.random()<0.5)?1:-1;stepw = 0.02 + Math.random()/9;steph = 1.3 + Math.random();} move += stepw *dir; if (Math.abs(move) > 3) {dir=-dir; posh+=Math.abs(movh*move);posw+=movw*move; move=0;} objstyle = findDOM('snow'+i,1); objstyle.left = (posX()+posw + movw*move)+'px'; objstyle.top = (posY()+posh + movh*(Math.abs(Math.cos(move)+move)))+'px';objstyle.visibility = 'visible';} setTimeout("moreSnow()", speed);}
     

    Billl Gates

    Well-known member
  • May 4, 2008
    11,573
    82
    48
    39
    Pita KOtte
    <script type="text/javascript">

    /******************************************
    * Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
    * Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
    * Last updated Nov 9th, 05' by DD. This notice must stay intact for use
    ******************************************/

    //Configure below to change URL path to the snow image
    var snowsrc="snow.gif"
    // Configure below to change number of snow to render
    var no = 10;
    // Configure whether snow should disappear after x seconds (0=never):
    var hidesnowtime = 0;
    // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
    var snowdistance = "pageheight";

    ///////////Stop Config//////////////////////////////////

    var ie4up = (document.all) ? 1 : 0;
    var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }

    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 (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
    } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
    }

    dx = new Array();
    xp = new Array();
    yp = new Array();
    am = new Array();
    stx = new Array();
    sty = new Array();
    snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "snow.gif" : snowsrc
    for (i = 0; i < no; ++ i) {
    dx = 0; // set coordinate variables
    xp = Math.random()*(doc_width-50); // set position variables
    yp = Math.random()*doc_height;
    am = Math.random()*20; // set amplitude variables
    stx = 0.02 + Math.random()/10; // set step variables
    sty = 0.7 + Math.random(); // set step variables
    if (ie4up||ns6up) {
    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 snowIE_NS6() { // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
    doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")? iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) { // iterate for every dot
    yp += sty;
    if (yp > doc_height-50) {
    xp = Math.random()*(doc_width-am-30);
    yp = 0;
    stx = 0.02 + Math.random()/10;
    sty = 0.7 + Math.random();
    }
    dx += stx;
    document.getElementById("dot"+i).style.top=yp+"px";
    document.getElementById("dot"+i).style.left=xp + am*Math.sin(dx)+"px";
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
    }

    function hidesnow(){
    if (window.snowtimer) clearTimeout(snowtimer)
    for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
    }


    if (ie4up||ns6up){
    snowIE_NS6();
    if (hidesnowtime>0)
    setTimeout("hidesnow()", hidesnowtime*1000)
    }

    </script>
     

    Billl Gates

    Well-known member
  • May 4, 2008
    11,573
    82
    48
    39
    Pita KOtte
    [FONT=Verdana, Arial, Helvetica, sans-serif]<script language="JavaScript1.2"> [/FONT] [FONT=Verdana, Arial, Helvetica, sans-serif]/*
    Snow Effect Script
    Created and submitted by Altan d.o.o. ([email protected], http://www.altan.hr/snow/index.html)
    Permission granted to Dynamicdrive.com to feature script in archive
    For full source code and installation instructions to this script, visit http://dynamicdrive.com
    */
    [/FONT]
    [FONT=Verdana, Arial, Helvetica, sans-serif] //Configure below to change URL path to the snow image
    var snowsrc="snow.gif"
    // Configure below to change number of snow to render
    var no = 10;
    [/FONT]
    [FONT=Verdana, Arial, Helvetica, sans-serif] var ns4up = (document.layers) ? 1 : 0; // browser sniffer
    var ie4up = (document.all) ? 1 : 0;
    [/FONT]
    [FONT=Verdana, Arial, Helvetica, sans-serif] 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;
    }
    [/FONT]
    [FONT=Verdana, Arial, Helvetica, sans-serif] 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 = 0; // set coordinate variables
    xp = Math.random()*(doc_width-50); // set position variables
    yp = Math.random()*doc_height;
    am = Math.random()*20; // set amplitude variables
    stx = 0.02 + Math.random()/10; // set step variables
    sty = 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 += sty;
    if (yp > doc_height-50) {
    xp = Math.random()*(doc_width-am-30);
    yp = 0;
    stx = 0.02 + Math.random()/10;
    sty = 0.7 + Math.random();
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
    }
    dx += stx;
    document.layers["dot"+i].top = yp;
    document.layers["dot"+i].left = xp + am*Math.sin(dx);
    }
    setTimeout("snowNS()", 10);
    }
    [/FONT]
    [FONT=Verdana, Arial, Helvetica, sans-serif] function snowIE() { // IE main animation function
    for (i = 0; i < no; ++ i) { // iterate for every dot
    yp += sty;
    if (yp > doc_height-50) {
    xp = Math.random()*(doc_width-am-30);
    yp = 0;
    stx = 0.02 + Math.random()/10;
    sty = 0.7 + Math.random();
    doc_width = document.body.clientWidth;
    doc_height = document.body.clientHeight;
    }
    dx += stx;
    document.all["dot"+i].style.pixelTop = yp;
    document.all["dot"+i].style.pixelLeft = xp + am*Math.sin(dx);
    }
    setTimeout("snowIE()", 10);
    }
    [/FONT]
    [FONT=Verdana, Arial, Helvetica, sans-serif] if (ns4up) {
    snowNS();
    } else if (ie4up) {
    snowIE();
    }
    [/FONT]
    [FONT=Verdana, Arial, Helvetica, sans-serif]</script>[/FONT]