Eclipse2564
01-07-2008, 08:50 PM
I'm running a website and I need a simple way to have an item show for example, "Day's left (# number of days left)" and automatically change after each day. Can it be done with HTML?
|
Click to See Complete Forum and Search --> : Days left... Eclipse2564 01-07-2008, 08:50 PM I'm running a website and I need a simple way to have an item show for example, "Day's left (# number of days left)" and automatically change after each day. Can it be done with HTML? dtm32236 01-07-2008, 08:55 PM you can do it with JavaScript: http://www.hashemian.com/tools/javascript-countdown.htm Eclipse2564 01-07-2008, 09:01 PM you can do it with JavaScript: http://www.hashemian.com/tools/javascript-countdown.htm That's what I'm afraid of. I need to be able to display it in a message board post like this one and scripts aren't allowed. scragar 01-07-2008, 09:02 PM you could use a server side language and have it change an image... Eclipse2564 01-07-2008, 09:13 PM you could use a server side language and have it change an image... So you mean like image rotation? scragar 01-07-2008, 09:28 PM very similar idea, here's a PHP version: <? // set header. header ("Content-type: image/png"); // get time string. $theTime = strtotime("10 September 2008"); // set your date of choice. $now = strtotime("now"); $timeLeft = $theTime - $now; $days = floor($timeLeft/60/60/24); if($days){ $theText = ($days==1)?"1 day left":$days . " Day(s) left"; }else{ $theText = "You've missed it"; }; // create image. $im = @imagecreatetruecolor(120, 20) or die("Cannot create new image"); // assign colours, using rgb. $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); // fill image and add text. imagefill($im, 1, 1, $white); imagestring($im, 1, 5, 5, $theText, $black); // show image. imagepng($im); // destroy image to save memory. imagedestroy($im); ?>shouldn't be too hard to make versions in other languages. you can see this in action here (http://scragar.mybesthost.com/time.php?d=10+September+2008) webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |