The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
4 posters

    JavaScript stops working.

    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    In progress JavaScript stops working.

    Post by smurfavr September 22nd 2017, 1:59 pm

    Last year I used this JavaScript but it does not work our forum now. What is the problem and how do I fix it?

    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="http://i59.servimg.com/u/f59/16/34/78/03/qqqq8310.gif"
      // Configure below to change number of snow to render
      var no = 30;
      // 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[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://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[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>
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    In progress Re: JavaScript stops working.

    Post by SLGray September 22nd 2017, 5:23 pm

    Please add the JavaScript to the forum and give us the link to the forum.



    JavaScript stops working. Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    In progress Re: JavaScript stops working.

    Post by smurfavr September 22nd 2017, 8:48 pm

    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    In progress Re: JavaScript stops working.

    Post by SLGray September 22nd 2017, 11:51 pm

    Do you have JavaScript Management activated?



    JavaScript stops working. Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    In progress Re: JavaScript stops working.

    Post by smurfavr September 23rd 2017, 10:22 am

    SLGray wrote:Do you have JavaScript Management activated?

    Yes.
    Jucarese
    Jucarese
    Hyperactive


    Male Posts : 2539
    Reputation : 118
    Language : spanish
    Location : SSF Admin

    In progress Re: JavaScript stops working.

    Post by Jucarese September 23rd 2017, 3:38 pm

    Try this:
    Code:
        <script type="text/javascript">
        var speed=40; // Speed ​​/ A smaller number faster
        var flakes=20; // Configure below to change number of snow to render
        var flake_image="http://i59.servimg.com/u/f59/16/34/78/03/qqqq8310.gif"; //image url
        var swide, shigh;
        var dx=new Array();
        var xp=new Array();
        var yp=new Array();
        var am=new Array();
        var sty=new Array();
        window.onload=function() { if (document.getElementById) {
        var k, f, b;
        b=document.createElement("div");
        b.style.position="absolute";
        b.setAttribute("id", "bod");
        document.body.appendChild(b);
        set_scroll();
        set_width();
        for (var i=0; i<flakes; i++) {
        dx[i]=0;
        am[i]=Math.random()*20;
        xp[i]=am[i]+Math.random()*(swide-2*am[i]-25);
        yp[i]=Math.random()*shigh;
        sty[i]=0.75+1.25*Math.random();
        f=document.createElement("div");
        f.style.position="absolute";
        f.setAttribute("id", "flk"+i);
        f.style.zIndex=i;
        f.style.top=yp[i]+"px";
        f.style.left=xp[i]+"px";
        k=document.createElement("img");
        k.src=flake_image;
        f.appendChild(k);
        b.appendChild(f);
        }
        setInterval("winter_snow()", speed);
        }}
        window.onresize=set_width;
        function set_width() {
        if (document.documentElement && document.documentElement.clientWidth) {
        swide=document.documentElement.clientWidth;
        shigh=document.documentElement.clientHeight;
        }
        else if (typeof(self.innerHeight)=="number") {
        swide=self.innerWidth;
        shigh=self.innerHeight;
        }
        else if (document.body.clientWidth) {
        swide=document.body.clientWidth;
        shigh=document.body.clientHeight;
        }
        else {
        swide=800;
        shigh=600
        }
        }
        window.onscroll=set_scroll;
        function set_scroll() {
        var sleft, sdown;
        if (typeof(self.pageYOffset)=="number") {
        sdown=self.pageYOffset;
        sleft=self.pageXOffset;
        }
        else if (document.body.scrollTop || document.body.scrollLeft) {
        sdown=document.body.scrollTop;
        sleft=document.body.scrollLeft;
        }
        else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
        sleft=document.documentElement.scrollLeft;
        sdown=document.documentElement.scrollTop;
        }
        else {
        sdown=0;
        sleft=0;
        }
        document.getElementById("bod").style.top=sdown+"px";
        document.getElementById("bod").style.left=sleft+"px";
        }
        function winter_snow() {
        for (var i=0; i<flakes; i++) {
        yp[i]+=sty[i];
        if (yp[i]>shigh-30) {
        xp[i]=am[i]+Math.random()*(swide-2*am[i]-25);
        yp[i]=0;
        sty[i]=0.75+1.25*Math.random();
        }
        dx[i]+=0.02+Math.random()/10;
        document.getElementById("flk"+i).style.top=yp[i]+"px";
        document.getElementById("flk"+i).style.left=(xp[i]+am[i]*Math.sin(dx[i]))+"px";
        }
        }
        </script>
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    In progress Re: JavaScript stops working.

    Post by smurfavr September 24th 2017, 12:31 pm

    Did not work.
    Jucarese
    Jucarese
    Hyperactive


    Male Posts : 2539
    Reputation : 118
    Language : spanish
    Location : SSF Admin

    In progress Re: JavaScript stops working.

    Post by Jucarese September 24th 2017, 3:13 pm

    then it's a problem with some of your forum because I use it and it works perfectly

    JavaScript stops working. U9ug2XzyRsCOnG-2nYfNxw

    Where are you placing in the index message??
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    In progress Re: JavaScript stops working.

    Post by smurfavr September 25th 2017, 11:32 am

    My code worked last year on my forum, but it is not working now. I do not know what is due.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    In progress Re: JavaScript stops working.

    Post by SLGray September 25th 2017, 8:33 pm

    Did you do something right before this JavaScript stopped working?



    JavaScript stops working. Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    In progress Re: JavaScript stops working.

    Post by smurfavr September 25th 2017, 10:13 pm

    This code used it last autumn. Then he worked, and now he does not want to.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    In progress Re: JavaScript stops working.

    Post by SLGray September 25th 2017, 10:25 pm

    We understand that, but have you modified or added anything during the time?



    JavaScript stops working. Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    In progress Re: JavaScript stops working.

    Post by smurfavr September 26th 2017, 12:01 pm

    Only JavaScript code has been added.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    In progress Re: JavaScript stops working.

    Post by SLGray September 26th 2017, 7:10 pm

    If you added new JavaScripts, it could be they are causing the issue with the falling snow one.



    JavaScript stops working. Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    In progress Re: JavaScript stops working.

    Post by Draxion September 26th 2017, 7:33 pm

    If that one is outdated, there are plenty more you can use that we have listed on this forum for holiday decor. If they work or not may depend on what other JavaScripts you use.
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    In progress Re: JavaScript stops working.

    Post by smurfavr September 26th 2017, 9:12 pm

    How do I know what the problem is about? Some admin could check?
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    In progress Re: JavaScript stops working.

    Post by SLGray September 26th 2017, 9:46 pm

    You will have to remove all JavaScripts and add them back one by one to see if there is conflicts.



    JavaScript stops working. Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    avatar
    Guest
    Guest


    In progress Re: JavaScript stops working.

    Post by Guest September 27th 2017, 6:41 pm

    The problem with that code is that it's not javascript, it's HTML+JS. If you add it to the JS Codes Management, it'll screw the forum up. Also, there are a few errors in the code:
    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="http://i59.servimg.com/u/f59/16/34/78/03/qqqq8310.gif";
              // Configure below to change number of snow to render
              var no = 30;
              // 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[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://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[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>
    If I were you, I wouldn't use this code. It's way too old and badly written. Note that this code will work if you place it in the templates or another place that accepts html. If you need to place it in the JS Code Management part of the panel, announce me.
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    In progress Re: JavaScript stops working.

    Post by smurfavr October 4th 2017, 12:04 pm

    Justiceâ„¢ wrote:The problem with that code is that it's not javascript, it's HTML+JS. If you add it to the JS Codes Management, it'll screw the forum up. Also, there are a few errors in the code:
    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="http://i59.servimg.com/u/f59/16/34/78/03/qqqq8310.gif";
              // Configure below to change number of snow to render
              var no = 30;
              // 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[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://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[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>
    If I were you, I wouldn't use this code. It's way too old and badly written. Note that this code will work if you place it in the templates or another place that accepts html. If you need to place it in the JS Code Management part of the panel, announce me.


    I put the code in Javascript, but it does not work.

    Test site.
    http://vracatestforum.bulgarianforum.net/forum

      Current date/time is September 22nd 2024, 1:25 pm