i need a little help with a tilout javascript :)

  • cmplieger
  • Born
  • Born
  • cmplieger
  • Posts: 1

Post 3+ Months Ago

Hey guys im new here :)

I need a little help with this javascript. It works well but never it doesnt seem to execute
Code: [ Select ]
window.setTimeout(reChangeClass, 3000);
when you change classes. The problem simply is the classes do not change to "slidreset" but stay on "slide" or "slide2"

could anyone help me?? thanks a lot :)

Code: [ Select ]
function addListener(o, e, f) {
    if (o.addEventListener) {
        o.addEventListener(e, f, false);
    } else {
        o.attachEvent("on" + e, f);
    }
}
 
 
 
function bindAnchors() {
    try {
        var collection1 = document.getElementById("topmenu").getElementsByTagName("a");
        for (i = 0; i <= collection1.length - 1; ++i) {
            var lien = collection1.item(i);
            if (lien.className != 'noslide')
                addListener(lien, "click", changeClass2);
        }
    } catch (e) {}
    try {
        var collection2 = document.getElementById("content").getElementsByTagName("a");
        for (i = 0; i <= collection2.length - 1; ++i) {
            var lien = collection2.item(i);
            if (lien.className != 'noslide')
                addListener(lien, "click", changeClass1);
        }
    } catch (e) {}
    try {
        var collection5 = document.getElementById("footer").getElementsByTagName("a");
        for (i = 0; i <= collection5.length - 1; ++i) {
            var lien = collection5.item(i);
            if (lien.className != 'noslide')
                addListener(lien, "click", changeClass1);
        }
    } catch (e) {}
    try {
        var collection3 = document.getElementById("toprightmenu").getElementsByTagName("a");
        for (i = 0; i <= collection3.length - 1; ++i) {
            var lien = collection3.item(i);
            if (lien.className != 'noslide')
                addListener(lien, "click", changeClass1);
        }
    } catch (e) {}
    try {
        var collection4 = document.getElementById("toprightbutton").getElementsByTagName("a");
        for (i = 0; i <= collection4.length - 1; ++i) {
            var lien = collection4.item(i);
            if (lien.className != 'noslide')
                addListener(lien, "click", changeClass1);
        }
    } catch (e) {}
}
 
 
function reChangeClass() {
    document.getElementById("content").className = "slidereset";
    document.getElementById("footer").className = "slidereset";
    document.getElementById("list").className = "slidereset";
}
 
 
function changeClass1() {
    document.getElementById("content").className = "slide";
    document.getElementById("footer").className = "slide";
    document.getElementById("list").className = "slide";
    window.setTimeout(reChangeClass, 3000);
 
 
}
 
 
function changeClass2() {
    document.getElementById("content").className = "slide2";
    document.getElementById("footer").className = "slide2";
    document.getElementById("list").className = "slide2";
    window.setTimeout(reChangeClass, 3000);
}
 
addListener(window, "load", bindAnchors);
 
  1. function addListener(o, e, f) {
  2.     if (o.addEventListener) {
  3.         o.addEventListener(e, f, false);
  4.     } else {
  5.         o.attachEvent("on" + e, f);
  6.     }
  7. }
  8.  
  9.  
  10.  
  11. function bindAnchors() {
  12.     try {
  13.         var collection1 = document.getElementById("topmenu").getElementsByTagName("a");
  14.         for (i = 0; i <= collection1.length - 1; ++i) {
  15.             var lien = collection1.item(i);
  16.             if (lien.className != 'noslide')
  17.                 addListener(lien, "click", changeClass2);
  18.         }
  19.     } catch (e) {}
  20.     try {
  21.         var collection2 = document.getElementById("content").getElementsByTagName("a");
  22.         for (i = 0; i <= collection2.length - 1; ++i) {
  23.             var lien = collection2.item(i);
  24.             if (lien.className != 'noslide')
  25.                 addListener(lien, "click", changeClass1);
  26.         }
  27.     } catch (e) {}
  28.     try {
  29.         var collection5 = document.getElementById("footer").getElementsByTagName("a");
  30.         for (i = 0; i <= collection5.length - 1; ++i) {
  31.             var lien = collection5.item(i);
  32.             if (lien.className != 'noslide')
  33.                 addListener(lien, "click", changeClass1);
  34.         }
  35.     } catch (e) {}
  36.     try {
  37.         var collection3 = document.getElementById("toprightmenu").getElementsByTagName("a");
  38.         for (i = 0; i <= collection3.length - 1; ++i) {
  39.             var lien = collection3.item(i);
  40.             if (lien.className != 'noslide')
  41.                 addListener(lien, "click", changeClass1);
  42.         }
  43.     } catch (e) {}
  44.     try {
  45.         var collection4 = document.getElementById("toprightbutton").getElementsByTagName("a");
  46.         for (i = 0; i <= collection4.length - 1; ++i) {
  47.             var lien = collection4.item(i);
  48.             if (lien.className != 'noslide')
  49.                 addListener(lien, "click", changeClass1);
  50.         }
  51.     } catch (e) {}
  52. }
  53.  
  54.  
  55. function reChangeClass() {
  56.     document.getElementById("content").className = "slidereset";
  57.     document.getElementById("footer").className = "slidereset";
  58.     document.getElementById("list").className = "slidereset";
  59. }
  60.  
  61.  
  62. function changeClass1() {
  63.     document.getElementById("content").className = "slide";
  64.     document.getElementById("footer").className = "slide";
  65.     document.getElementById("list").className = "slide";
  66.     window.setTimeout(reChangeClass, 3000);
  67.  
  68.  
  69. }
  70.  
  71.  
  72. function changeClass2() {
  73.     document.getElementById("content").className = "slide2";
  74.     document.getElementById("footer").className = "slide2";
  75.     document.getElementById("list").className = "slide2";
  76.     window.setTimeout(reChangeClass, 3000);
  77. }
  78.  
  79. addListener(window, "load", bindAnchors);
  80.  
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 110 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.