View Full Version : Watching a countdown timer with greasemonkey?

03-21-2009, 01:33 AM
Hello all,

I'm new here and first of all I'd like to admit that I know almost nothing about javascript, I'm just starting out and I don't know the lingo. I'm kinda just doing this for fun.

What I would like to do is watch a countdown timer on a page, like the ones on swoopo.co.uk and then perfom an action depending on what time is left on the timer.

I've installed DOM inspector on Firefox and poked around with javascript shell and I think I've figured out how to read the timer and assign that to a variable, something like this -

var timer=document.getElementById('counter_index_page_162980').innerHTML;

Now I need to watch that so I guessed this would do -

while (timer!=="00:00:01")
var timer=document.getElementById('counter_index_page_162980').innerHTML;

alert('timer at 1 sec!');

But that just brings up an "unresponsive script" error in my browser.

Am I even close to the mark? I know I'm not going to win any auctions with this but I've already paid for the bids so I may as well use them now.


03-21-2009, 02:35 AM
font: bold 12px MS Sans Serif ;


<script type = "text/javascript">

var txt ="";
var num = 5; /* erase after num seconds, adjust to suit*/
var loopspeed=.01;
function showLoad() {
num -=loopspeed;
txt = "This countdown will end in " + num.toFixed(2) + " seconds. <br><br>This page best viewed with Firefox<img src='http://i41.tinypic.com/4ictfp.jpg' style='position:absolute;top:250;left:500;'>";
document.getElementById("a").innerHTML = txt;

if (num < loopspeed) {
txt = "Loading completed.<br><br>Thank you for using <big><big>TinyScript<big><big>";
document.getElementById("a").innerHTML = txt;
setTimeout("doneload()", 2500)
setTimeout("showLoad()", 10)


function doneload(){


<body onload = "showLoad()">
<div id = "a" class="pageload"></div>


here is a count down script. Someone here posted it but I added a few things