The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

JavaScript stops working.

View previous topic View next topic Go down

In progress JavaScript stops working.

Post by smurfavr on 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>
avatar
smurfavr
Active Poster

Male Posts : 1582
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: JavaScript stops working.

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

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


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40478
Reputation : 2730
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

In progress Re: JavaScript stops working.

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

avatar
smurfavr
Active Poster

Male Posts : 1582
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: JavaScript stops working.

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

Do you have JavaScript Management activated?


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40478
Reputation : 2730
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

In progress Re: JavaScript stops working.

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

SLGray wrote:Do you have JavaScript Management activated?

Yes.
avatar
smurfavr
Active Poster

Male Posts : 1582
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: JavaScript stops working.

Post by jucarese on 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>
avatar
jucarese
Active Poster

Male Posts : 1206
Reputation : 21
Language : spanish
Location : Admin Spanish support

http://asistencia.foroactivo.com/u23082

Back to top Go down

In progress Re: JavaScript stops working.

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

Did not work.
avatar
smurfavr
Active Poster

Male Posts : 1582
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: JavaScript stops working.

Post by jucarese on September 24th 2017, 3:13 pm

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



Where are you placing in the index message??
avatar
jucarese
Active Poster

Male Posts : 1206
Reputation : 21
Language : spanish
Location : Admin Spanish support

http://asistencia.foroactivo.com/u23082

Back to top Go down

In progress Re: JavaScript stops working.

Post by smurfavr on 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.
avatar
smurfavr
Active Poster

Male Posts : 1582
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: JavaScript stops working.

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

Did you do something right before this JavaScript stopped working?


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40478
Reputation : 2730
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

In progress Re: JavaScript stops working.

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

This code used it last autumn. Then he worked, and now he does not want to.
avatar
smurfavr
Active Poster

Male Posts : 1582
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: JavaScript stops working.

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

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


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40478
Reputation : 2730
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

In progress Re: JavaScript stops working.

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

Only JavaScript code has been added.
avatar
smurfavr
Active Poster

Male Posts : 1582
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: JavaScript stops working.

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

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


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40478
Reputation : 2730
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

In progress Re: JavaScript stops working.

Post by Draxion on 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.


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 1797
Reputation : 225
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

In progress Re: JavaScript stops working.

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

How do I know what the problem is about? Some admin could check?
avatar
smurfavr
Active Poster

Male Posts : 1582
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: JavaScript stops working.

Post by SLGray on 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.


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40478
Reputation : 2730
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

In progress Re: JavaScript stops working.

Post by Justice™ on 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.
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

In progress Re: JavaScript stops working.

Post by smurfavr on 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
avatar
smurfavr
Active Poster

Male Posts : 1582
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum