i am developing an online exam application so i used stop watch. But this stop watch is reset when page is reload or press F5 button. I don't want to reset stop watch. So please help me i am so in trouble.
My code is :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default7.aspx.cs" Inherits="Default7" %>
<!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 runat="server">
<title></title>
<script type="text/javascript" language="javascript">
var msec = 0;
var sec = 0;
var min = 0;
function starttimer(){
var hdntime = document.getElementById("hdntime");
hdntime.innerHTML = min + ":" + sec + ":" + msec;
go = setTimeout("starttimer()", 1);
msec++;
if (msec == 100) {
msec = 0;
sec++;
}
if (sec == 60) {
sec = 0;
min++;
}
}
function resetwatch() {
window.location.reload();
}
</script>
</head>
<body>
<form id="form1" runat="server">
00:00:00
<input id="Button1" type="button" value="Start Watch" onclick="starttimer()"/>
<input id="Button2" runat="server" type="button" value="Stop Watch" onclick="stopwatch()" />
<input id="Button3" type="button" value="Reset Watch" onclick="resetwatch()" />
</form>
</body>
</html>