I need to display a timer for an examination on my web page. Using VB.NET.

I need to display a timer for an examination on my web page. Using VB.NET.

Can this be done easily?

Kind Regards

PG

pgilfeatherAsked:
Who is Participating?
 
Saqib KhanConnect With a Mentor Senior DeveloperCommented:
OK here is a Basic Example. Simply Copy Paste and save it as a HTML file to see it in Action.
once understood integerate it with your PAGE (by copying Counter() Function and calling it within BODY tag)

Good Luck.



<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>

<script>
var Duration;
Duration = 60; // 1 hours(60 Minutes)

function Counter() {

      var frm = document.f1.t1
      
      if(Duration >= 0) {
            frm.value = Duration;
            Duration--;
            
            T = setTimeout("Counter()", 1000*60)
      } else {
          
            alert("Session Expired")
            // or you can redirect to a different page by placing this line  document.location = "page_name.html"
            return false
      }
}

</script>
</head>

<body onload="return Counter()">

<form method="POST" name="f1">
      <p><input type="text" name="t1" size="20"></p>
</form>

</body>

</html>
0
 
dfu23Commented:
I would suggest using javascript .... what do you need to do?

A countdown?

Or show the current time?
0
 
pgilfeatherAuthor Commented:
I need a countdown.

I have two problems...I have never really used javascript and I need to respond to the event of the counter getting to zero.

If you could talk me through how to do this I would be very thankful as I have a very tight deadline.

Kind Regards

PG
0
 
dfu23Commented:
Ok, I've responding to this question here and in the VB.NET topic area ... take a look at my post over there ... it shows the general idea to start in Javascript
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.