Ciao a tutti,
non conosco javascript però ho avuto la necessità di inserire nella mia pagine html il codice che posto di seguito al fine di rendere l'animazione dell pioggia. Appena clicco su un pulsante si anima ed inizia a piovere ... ora io vorrei trovare il modo di stoppare lo script cliccando su un altro pulsante ma non ci riesco. Ecco il codice

Codice PHP:
(function rain() {
    var 
= (function () {
        var 
navigator.appVersion.toLowerCase();
        
= (z.indexOf("msie") > -1) ? parseInt(z.replace(/.*msie[ ]/, "").match(/^[0-9]+/)) : 0;
        return {
            
ltIE6<= && != 0,
            
ltIE7<= && != 0,
            
ltIE8<= && != 0,
            
ltIE9<= && != 0,
            
ie!= 0,
            
firefoxwindow.globalStorage,
            
operawindow.opera,
            
webkit: !document.uniqueID && !window.opera && !window.globalStorage && window.localStorage,
            
mobile: /android|iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase())
        }
    })();
    var 
"codes";
    var 
100;
    var 
2;
    var 
15;
    var 
3;
    var 
1;
    var 
0;
    var 
"png";
    var 
"http://htmlfreecodes.com/";
    var 
"/";
    var 
document.body;
    var 
"giffy_bp_" o;
    var 
= new Date().getTime();
    var 
10;
    var 
20;
    var 
50;
    var 
1000;
    var 
false;
    var 
= new Array();
    var 
= new Array();
    var 
0;
    var 
= {
        
x0,
        
y0
    
};
    
window[c] = {
        
init: function rain1() {
            for (
0gi++) {
                var 
document.createElement("div");
                
A.style.position "fixed";
                
A.style.overflow "hidden";
                
A.style.visibility "hidden";
                
A.style.top 0;
                
A.style.left 0;
                
A.style.zIndex i;
                var 
document.createElement("img");
                
z.style.border "0";
                
A.appendChild(z);
                
k.appendChild(A);
                
r[i] = {
                    
objA,
                    
imgz,
                    
action0,
                    
fromh,
                    
toh,
                    
begin0,
                    
duration0
                
}
            }
            for (
0ui++) {
                
n[i] = new Image();
                
n[i].src "b" + (1) + "." + (== "?" "")
            }
            
m.action();
            
setInterval(m.actiond)
        },
        
action: function rain2() {
            if (!
a) {
                for (
0uC++) {
                    if (
n[C].height == 0) {
                        return
                    }
                }
                
true
            
}
            var 
= {
                
heightm.getViewHeight(),
                
widthm.getViewWidth(),
                
top0,
                
bottomm.getViewHeight()
            };
            for (var 
0gC++) {
                switch (
r[C].action) {
                case 
0:
                    if (
m.getRandomNum(l) == 0) {
                        var 
n[m.getRandomNum(u)];
                        
r[C].img.src B.src;
                        var 
m.getRandomNum(A.width B.width);
                        
r[C].from = {
                            
xz,
                            
y0
                        
};
                        
r[C].to = {
                            
xz,
                            
yA.height
                        
};
                        
r[C].begin = new Date() - 0;
                        
r[C].duration A.height s;
                        if (
0) {
                            
r[C].duration *= (+ (0.1 * (m.getRandomNum(2) == : -1) * m.getRandomNum(q)))
                        }
                        
r[C].action 1;
                        
m.move(r[C].objr[C].from);
                        
m.setVisible(r[C].obj)
                    }
                    break;
                case 
1:
                    var 
= new Date() - r[C].begin;
                    if (
r[C].duration) {
                        
m.move(r[C].objm.easingPos(Dr[C].fromr[C].tor[C].duration))
                    } else {
                        
m.setHidden(r[C].obj);
                        
r[C].action 0
                    
}
                    break
                }
            }
        },
        
getRandomNum: function (z) {
            return 
Math.floor(Math.random() * z)
        },
        
getViewHeight: function () {
            if (
window.innerHeight) {
                return 
window.innerHeight
            
}
            if (
document.documentElement && document.documentElement.clientHeight) {
                return 
document.documentElement.clientHeight
            
} else {
                if (
document.body && document.body.clientHeight) {
                    return 
document.body.clientHeight
                
}
            }
            return 
0
        
},
        
getViewWidth: function rain4() {
            if (
window.innerWidth) {
                return 
window.innerWidth
            
}
            if (
document.documentElement && document.documentElement.clientWidth) {
                return 
document.documentElement.clientWidth
            
} else {
                if (
document.body && document.body.clientWidth) {
                    return 
document.body.clientWidth
                
}
            }
            return 
0
        
},
        
getViewTop: function rain5() {
            if (
window.scrollY) {
                return 
window.scrollY
            
}
            if (
window.pageYOffset) {
                return 
window.pageYOffset
            
}
            if (
document.documentElement && document.documentElement.scrollTop) {
                return 
document.documentElement.scrollTop
            
} else {
                if (
document.body && document.body.scrollTop) {
                    return 
document.body.scrollTop
                
}
            }
            return 
0
        
},
        
getViewBottom: function rain6() {
            return 
m.getViewTop() + m.getViewHeight()
        },
        
getViewLeft: function rain7() {
            if (
window.scrollX) {
                return 
window.scrollX
            
}
            if (
window.pageXOffset) {
                return 
window.pageXOffset
            
}
            if (
document.documentElement && document.documentElement.scrollLeft) {
                return 
document.documentElement.scrollLeft
            
} else {
                if (
document.body && document.body.scrollLeft) {
                    return 
document.body.scrollLeft
                
}
            }
            return 
0
        
},
        
getViewRight: function rain8() {
            return 
m.getViewLeft() + m.getViewWidth()
        },
        
easing: function rain9(ACBz) {
            return (
C) * C
        
},
        
easingPos: function rain10(ACBz) {
            return {
                
xm.easing(AC.xB.xz),
                
ym.easing(AC.yB.yz)
            }
        },
        
move: function rain11(zA) {
            
z.style.top A."px";
            
z.style.left A."px"
        
},
        
setHidden: function rain12(z) {
            
z.style.visibility "hidden"
        
},
        
setVisible: function rain13(z) {
            
z.style.visibility "visible"
        
}
    };
    var 
window[c];
    
m.init()
})();