<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Cronometro in jquery]]></title><description><![CDATA[<p dir="auto">Salve a tutti, devo inserire un cronometro in una pagina web, ho inserito nell'header jquery.timer e trovato questo esempio online:</p>
<pre><code>var Example1 = new (function() {

    // Stopwatch element on the page
    var $stopwatch;
    
    // Timer speed in milliseconds
    var incrementTime = 60;


    // Current timer position in milliseconds
    var currentTime = 0;
    
    // Start the timer


    $(function(){ 
        $stopwatch = $('#time');    
        Example1.Timer = $.timer(updateTimer, incrementTime, true);  
    });


    // Output time and increment
    function updateTimer() {
        var timeString = formatTime(currentTime);
        $stopwatch.html(timeString);
        currentTime += incrementTime;
    }


    // Reset timer
    this.resetStopwatch = function() {
        currentTime = 0;
        Example1.Timer.stop().once();
    };


});


// Common functions
function pad(number, length) {
    var str = '' + number;
    while (str.length &lt; length) {str = '0' + str;}
    return str;
}
function formatTime(time) {
    time = time / 10;
    var min = parseInt(time / 6000),
        sec = parseInt(time / 100) - (min * 60),
        hundredths = pad(time - (sec * 100) - (min * 6000), 2);
    return (min &gt; 0 ? pad(min, 2) : "00") + ":" + pad(sec, 2) + ":" + hundredths;
}
</code></pre>
<p dir="auto">Funziona al caricamento della pagina, io però vorrei attivarlo e disattivarlo al click del mouse. Qualcuno sa come adattarlo?<br />
Grazie in anticipo</p>
]]></description><link>https://dev.connect.gt/topic/214880/cronometro-in-jquery</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 04:58:50 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/214880.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 11 Jun 2015 14:48:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Cronometro in jquery on Fri, 26 Jun 2015 17:19:07 GMT]]></title><description><![CDATA[<p dir="auto">Devi applicare il gestore dell'evento click sull'elemento che vuoi utilizzare e metterci dentro quello che vuoi.</p>
<pre><code>$( [COLOR=#DD1144]"#target"[/COLOR] ).click([B]function[/B]() {

  //qui mettici quello che vuoi eseguire

});
</code></pre>
]]></description><link>https://dev.connect.gt/post/1201189</link><guid isPermaLink="true">https://dev.connect.gt/post/1201189</guid><dc:creator><![CDATA[artasdog]]></dc:creator><pubDate>Fri, 26 Jun 2015 17:19:07 GMT</pubDate></item></channel></rss>