Results 1 to 2 of 2

Thread: Snow Not working

  1. #1
    Join Date
    Dec 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Snow Not working

    Hello there guys, i'm new to the forum, and to web scripting. I have a small problem about the snow effect, after inserting the script to the website and after the website gets published I don't get on the page the snow flakes, i get little icons that indicate that the image link hasn't been found. Take a look at the code and please tell me what did I do wrong ... Try to use simple terms, as I said I am new in coding...

    Code:
     <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="/files/theme/oIfCied.gif"
      // Configure below to change number of snow to render
      var no = 35;
      // 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("http://i.imgur.com/")!=-1)? "oIfCied.gif" : snowsrc
      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 (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://i.imgur.com\"><img src='/files/theme/"+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='/files/theme/"+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[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();
          }
          dx[i] += stx[i];
          document.getElementById("dot"+i).style.top=yp[i]+"px";
          document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"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>
    Last edited by keyboard; 12-02-2013 at 08:35 PM. Reason: Format: Code Tags [code][/code]

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,133
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    There is no way to be sure without a link to the page. But the most common reason would be that:

    var snowsrc="/files/theme/oIfCied.gif"
    is 404 Not Found. Perhaps you meant:

    Code:
    var snowsrc="files/theme/oIfCied.gif"
    Or there could be a typo. Also, upper and lower case letters matter. So even if the path an filename are correct, if the case of the letters do not match, the file will not be found.

    The browser cache may need to be cleared and/or the page refreshed to see changes.

    There could also be other problems.

    If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Snow fall script not working in firefox
    By hellays in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 12-08-2009, 11:11 PM
  2. Snow effect working in E5+ and not in FF
    By ostcalling in forum HTML
    Replies: 1
    Last Post: 10-14-2008, 07:10 PM
  3. snow effect not working in FF
    By alexloony in forum Dynamic Drive scripts help
    Replies: 6
    Last Post: 12-03-2007, 08:32 AM
  4. Snow-more
    By ukrockhit in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 12-05-2005, 02:46 PM
  5. *Snow
    By kate in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 12-20-2004, 11:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •