Ruft verschachtelte Funktion mit javascript

Ich habe dieser code ruft eine Funktion test() on body onload

<body onLoad="test();">

Die Test-Funktion hat 2 weitere Funktionen drawLayers() ,StopAll().

function test() {

  function drawLayers() {
   timers = [];
        timers.push(setTimeout(drawMoon,800));
       timers.push(setTimeout(drawCircle1,2300));
        timers.push(setTimeout(drawCircle2,2700));
    timers.push(setTimeout(drawCircle3,3100));
        timers.push(setTimeout(drawCircle4,3500));
        timers.push(setTimeout(drawCircle5,3900));
        timers.push(setTimeout(drawtext2,4300));
        timers.push(setTimeout(drawtext,4700));
        timers.push(setTimeout(drawtext3,5100));
        timers.push(setTimeout(drawtext4,5500));
        timers.push(setTimeout(drawtext5,5900));
        timers.push(setTimeout(drawtext6,6300));
        timers.push(setTimeout(drawtext7,6700));
        timers.push(setTimeout(drawtext8,7100));
        timers.push(setTimeout(drawtext9,7500));
        timers.push(setTimeout(drawtext10,7900));



    }

 function StopAll() {
     alert('fsdfsdf');
        for (var i = 0; i < timers.length; i++)
             window.clearTimeout(timers[i]);
    }
}

Was ich will zu tun ist, Rufen Sie die StopAL () - Funktion auf Knopfdruck den html-code sieht wie folgt aus

<a href="javascript:void(0);" onClick="StopAll();">

Ihre werfen Fehler, "StopAll ist nicht definiert"

Wie rufe ich die StopALL () - Funktion?

InformationsquelleAutor satya | 2011-08-27

Schreibe einen Kommentar