cucumber Posted June 26, 2007 Report Share 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? Link to comment Share on other sites More sharing options...
andrisp Posted June 26, 2007 Report Share 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 Link to comment Share on other sites More sharing options...
v3rb0 Posted June 26, 2007 Report Share 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. Link to comment Share on other sites More sharing options...
cucumber Posted June 26, 2007 Author Report Share Posted June 26, 2007 Nez papetishu vel, abi varianti nostrada tikai vienu reizi ar aizkaveshanos. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted June 26, 2007 Report Share 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... Link to comment Share on other sites More sharing options...
andrisp Posted June 26, 2007 Report Share Posted June 26, 2007 Izmanto setInterval, ja tev vajag, lai atkārtojas. Link to comment Share on other sites More sharing options...
cucumber Posted June 26, 2007 Author Report Share Posted June 26, 2007 Yes, work properly. ty. Link to comment Share on other sites More sharing options...
Recommended Posts