Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Old 10-01-2009, 07:44 AM Countdown timer
Experienced Talker

Posts: 49
Trades: 0
Does anyone know an HTML code that I can add to my web page so that a 2 minute timer will automatically start counting down when ever a visitor visits my page.
DynamicFlooder is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-01-2009, 08:46 AM Re: Countdown timer
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
http://www.google.com/search?hl=en&l...=Google+Search
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 10-01-2009, 08:56 AM Re: Countdown timer
Experienced Talker

Posts: 38
Trades: 0
not too sure about doing it in HTML, but here's some javascript you can use:

Code:
var sec = 30;   // set the seconds
var min = 02;   // set the minutes

function countDown() {
  sec--;
  if (sec == -01) {
    sec = 59;
    min = min - 1;
  } else {
   min = min;
  }
if (sec<=9) { sec = "0" + sec; }
  time = (min<=9 ? "0" + min : min) + " min and " + sec + " sec ";
if (document.getElementById) { theTime.innerHTML = time; }
  SD=window.setTimeout("countDown();", 1000);
if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  countDown();
});
__________________
I am thewebtaylor!! Website design, SEO and marketing.


Please login or register to view this content. Registration is FREE
thewebtaylor is offline
Reply With Quote
View Public Profile
 
Old 10-01-2009, 12:27 PM Re: Countdown timer
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
You CAN"T do it with pure HTML - HTML is MARKUP, and what you need is some sort of scripting.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 10-02-2009, 12:46 AM JavaScript Countdown Timer
Junior Talker

Posts: 1
Name: Thai Cao Phong
Trades: 0
maybe you should try this script, JavaScript Countdown Timer

In example is 10 secs, you can fix to 2 mins easily


How to setup

Step 1: Copy & Paste CSS code below in your HEAD section
CSS
Code:
<style type="text/css">
#txt {
  border:none;
  font-family:verdana;
  font-size:16pt;
  font-weight:bold;
  border-right-color:#FFFFFF
}

</style>
    <!--
        This script downloaded from www.JavaScriptBank.com
        Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
    -->
Step 2: Copy & Paste JavaScript code below in your HEAD section
JavaScript
Code:
<script language="javascript">
// Created by: Neill Broderick :: http://www.bespoke-software-solutions.co.uk/downloads/downjs.php

var mins
var secs;

function cd() {
     mins = 1 * m("10"); // change minutes here
     secs = 0 + s(":01"); // change seconds here (always add an additional second to your total)
     redo();
}

function m(obj) {
     for(var i = 0; i < obj.length; i++) {
          if(obj.substring(i, i + 1) == ":")
          break;
     }
     return(obj.substring(0, i));
}

function s(obj) {
     for(var i = 0; i < obj.length; i++) {
          if(obj.substring(i, i + 1) == ":")
          break;
     }
     return(obj.substring(i + 1, obj.length));
}

function dis(mins,secs) {
     var disp;
     if(mins <= 9) {
          disp = " 0";
     } else {
          disp = " ";
     }
     disp += mins + ":";
     if(secs <= 9) {
          disp += "0" + secs;
     } else {
          disp += secs;
     }
     return(disp);
}

function redo() {
     secs--;
     if(secs == -1) {
          secs = 59;
          mins--;
     }
     document.cd.disp.value = dis(mins,secs); // setup additional displays here.
     if((mins == 0) && (secs == 0)) {
          window.alert("Time is up. Press OK to continue."); // change timeout message as required
          // window.location = "yourpage.htm" // redirects to specified page once timer ends and ok button is pressed
     } else {
         cd = setTimeout("redo()",1000);
     }
}

function init() {
  cd();
}
window.onload = init;
</script>
    <!--
        This script downloaded from www.JavaScriptBank.com
        Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
    -->
Step 3: Place HTML below in your BODY section
HTML
Code:
<form name="cd">
<input id="txt" readonly="true" type="text" value="10:00" border="0" name="disp">
</form>
    <!--
        This script downloaded from www.JavaScriptBank.com
        Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
    -->
JSBank is offline
Reply With Quote
View Public Profile
 
Old 10-02-2009, 08:34 AM Re: Countdown timer
Novice Talker

Posts: 2
Trades: 0
<script language="JavaScript">TargetDate = "12/31/2020 5:00 AM";BackColor = "palegreen";ForeColor = "navy";CountActive = true;CountStepper = -1;LeadingZero = true;DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";FinishMessage = "It is finally here!";</script><script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script>
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
rose_rain is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Countdown timer
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23404 seconds with 12 queries