• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

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

0
pgilfeather
Asked:
pgilfeather
  • 2
1 Solution
 
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
 
Saqib KhanSenior 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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now