cucumber Posted June 26, 2007 Report Posted June 26, 2007 Es timeouta gribu izsaukt citu funkciju ar argumentiem. <div onmousedown="java script:setTimeout("change('text','inc')",999);"> dari </div> Bet javascript saka ka esot kludas, meginaju likt sleshus, vai mainit " -> ' nekas nestradaja. Tad ka var uzrakstit timemout'a, lai nostradatu, gan f-ja ar parametriem, gan timemouts?
andrisp Posted June 26, 2007 Report Posted June 26, 2007 (edited) Es tev ieteiktu darīt kaut kā šādi: <script> window.onload = function() { document.getElementById('bla').onmousedown = function() { setTimeout(function() { change('text','inc'); }, 999); } } </script> <div id="bla">dara</div> Tas saucas unobtrusive javascript (http://www.google.lv/search?hl=lv&q=unobtrusive+javascript) Edited June 26, 2007 by andrisp
v3rb0 Posted June 26, 2007 Report Posted June 26, 2007 nu be pats neredzi, kur " sākas un kur " uzreiz beidzas pārraksti aptuveni šitā <script> function foo(){ setTimeout("change('text','inc')",999); } </script> <div onmousedown="foo()"> dari </div> vai arī esceipo tas iekšējās dubultās pēdas.
cucumber Posted June 26, 2007 Author Report Posted June 26, 2007 Nez papetishu vel, abi varianti nostrada tikai vienu reizi ar aizkaveshanos.
Grey_Wolf Posted June 26, 2007 Report Posted June 26, 2007 nostrada tikai vienu reizi ar aizkaveshanos. un ko tu citu gribeeji no setTimeout() ? aizkaveeshanas ir preciizi 999 milisekundes jeb ... 0,99 sek...
andrisp Posted June 26, 2007 Report Posted June 26, 2007 Izmanto setInterval, ja tev vajag, lai atkārtojas.
Recommended Posts