Click here to Skip to main content
15,911,762 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Link through javascript Pin
daveyerwin12-Aug-10 6:57
daveyerwin12-Aug-10 6:57 
AnswerRe: Link through javascript Pin
NeverHeardOfMe12-Aug-10 7:09
NeverHeardOfMe12-Aug-10 7:09 
GeneralRe: Link through javascript Pin
daveyerwin12-Aug-10 7:17
daveyerwin12-Aug-10 7:17 
GeneralRe: Link through javascript Pin
NeverHeardOfMe12-Aug-10 7:24
NeverHeardOfMe12-Aug-10 7:24 
Questioncountdown timer initializes on refreshing the page but it should not Pin
Amit Spadez11-Aug-10 19:33
professionalAmit Spadez11-Aug-10 19:33 
AnswerRe: countdown timer initializes on refreshing the page but it should not Pin
daveyerwin12-Aug-10 2:33
daveyerwin12-Aug-10 2:33 
GeneralRe: countdown timer initializes on refreshing the page but it should not Pin
Amit Spadez22-Aug-10 23:42
professionalAmit Spadez22-Aug-10 23:42 
GeneralRe: countdown timer initializes on refreshing the page but it should not [modified] Pin
daveyerwin24-Aug-10 8:09
daveyerwin24-Aug-10 8:09 
blockquote class="FQ">
vinci007 wrote:
Any alternative to this ??

Yes, store the start time in a cookie.

here is a very simple example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>My Timer Page</title>    
</head>
<body>
here is a timer that will keep count<br /> even if page is refreshed<br />press button to reset<br />
<div id="timerDisplay"></div>
<div><input type="button" onclick="myTimer.reSet()" /></div>
</body>
<script type="text/jscript">
    var myTimer = (function () {
        var readCookie = function () {
            var ca = document.cookie.split(';');
            for (var i = ca.length; i--; ) {
                var c = ca[i].split('name=');
                if (c.length == 2) return c[1];
            };
            return 0;
        };
        if (!readCookie()) {
            document.cookie = "name=" + (new Date().getTime()) + "; path=/"; 
        };
        var stuff = {};
        stuff.howLong = function () {
            return new Date().getTime() - readCookie() 
        };
        stuff.reSet = function () {
            document.cookie = "name=" + (new Date().getTime()) + "; path=/"; 
        };
        return stuff;        
    })();
    
    setInterval("document.getElementById('timerDisplay').innerHTML = myTimer.howLong();", 500);
    </script>
</html>


modified on Wednesday, August 25, 2010 9:45 PM

QuestionExecute the notepad data using querystring [modified] Pin
shailrathore9-Aug-10 23:10
shailrathore9-Aug-10 23:10 
AnswerRe: How to read/execute the notepad data using querystring Pin
Prosanta Kundu online10-Aug-10 18:29
Prosanta Kundu online10-Aug-10 18:29 
GeneralRe: How to read/execute the notepad data using querystring Pin
shailrathore10-Aug-10 23:36
shailrathore10-Aug-10 23:36 
QuestionHow to find all open browsers ? Pin
InderK9-Aug-10 0:52
InderK9-Aug-10 0:52 
AnswerRe: How to find all open browsers ? Pin
Prosanta Kundu online9-Aug-10 1:20
Prosanta Kundu online9-Aug-10 1:20 
GeneralRe: How to find all open browsers ? Pin
InderK9-Aug-10 2:13
InderK9-Aug-10 2:13 
GeneralRe: How to find all open browsers ? Pin
T M Gray12-Aug-10 5:11
T M Gray12-Aug-10 5:11 
GeneralRe: How to find all open browsers ? Pin
InderK12-Aug-10 5:38
InderK12-Aug-10 5:38 
GeneralRe: How to find all open browsers ? Pin
T M Gray12-Aug-10 10:01
T M Gray12-Aug-10 10:01 
AnswerRepost Pin
Not Active9-Aug-10 2:15
mentorNot Active9-Aug-10 2:15 
GeneralRe: Repost Pin
InderK9-Aug-10 2:22
InderK9-Aug-10 2:22 
GeneralRe: Repost Pin
Not Active9-Aug-10 3:13
mentorNot Active9-Aug-10 3:13 
QuestionCheck FIle Exist in Javascript Pin
ShafiqA8-Aug-10 20:10
ShafiqA8-Aug-10 20:10 
AnswerRe: Check FIle Exist in Javascript PinPopular
NeverHeardOfMe8-Aug-10 22:11
NeverHeardOfMe8-Aug-10 22:11 
QuestionCSS not getting implemented on the jQuery dialog within IE8 Pin
Vipul Mehta8-Aug-10 18:16
Vipul Mehta8-Aug-10 18:16 
Questionget input text value on text change Pin
Shantanu Gupta 13378-Aug-10 4:02
Shantanu Gupta 13378-Aug-10 4:02 
AnswerRe: get input text value on text change Pin
Sandeep Mewara8-Aug-10 4:47
mveSandeep Mewara8-Aug-10 4:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.