![]() |
|
|||||||
| JavaScript Programming Discuss javascript coding. |
| Have A Look At Some Of Our Webmaster Related Sponsors! | |||||
![]() Social Groups |
![]() Script Directory |
![]() Shopping Cart |
![]() Free Templates |
![]() 3D Guide-characters |
![]() Social Bookmarking |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#2 (permalink) |
|
The Dev Hunter
|
What will you be counting? What kind of site are you putting it in, PHP? HTML?
__________________
Website Launch l Bid for Position l Website Advertising l phpLD Template Blogl Bid for Top l WordPress Theme Blog |
|
|
|
|
|
#3 (permalink) |
|
Field Master
|
I think he might want something that is like a stop watch maybe?
__________________
Cellular Ringtones |
|
|
|
|
|
#5 (permalink) |
|
New Hunter
Join Date: Dec 2007
Location: United Kingdom - Dorset - Bournemouth
Posts: 85
iTrader: 0 / 0%
Hunter Bux: 5.00
![]() ![]() |
Code:
<script>
x = 0;
function count()
{
Object = document.getElementById('COUNT');
Object.innerHTML = "<a onClick=\"count()\" id=\"COUNT\">" + x + "</a>";
x = x + 1;
setTimeout("count()",1000);
}
</script>
<a onClick="count()" id="COUNT">Click to begin Counter.</a>
__________________
<!-- I can type the entire Alphabet in 2.19 seconds --> /* (X/D)Html, Css, Javascript, Ajax, Xml (DTD), PHP, MySQL, E4X */ /* Learning C++ and German */ |
|
|
|
|
|
#7 (permalink) |
|
Senior Moderator
|
http://www.dynamicdrive.com/dynamici...countingup.htm
revised for your need Code:
<html>
<head>
<style style="text/css">
.dcountstyle{ /*Example CSS to style count up output*/
font: bold 16px Arial;
padding: 3px;
}
.dcountstyle sup{ /*Example CSS to style count up output*/
font-size: 90%
}
</style>
<script type="text/javascript">
/***********************************************
* Dynamic CountUp script- ?? Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
function dcountup(startingdate, baseunit){
this.currentTime=new Date()
this.startingdate=new Date(startingdate)
this.timesup=false
this.baseunit=baseunit
this.start()
}
dcountup.prototype.oncountup=function(){} //default action for "oncountup"
dcountup.prototype.start=function(){
var thisobj=this
this.currentTime.setSeconds(this.currentTime.getSeconds()+1)
var timediff=(this.currentTime-this.startingdate)/1000 //difference btw target date and current date, in seconds
var oneMinute=60 //minute unit in seconds
var oneHour=60*60 //hour unit in seconds
var oneDay=60*60*24 //day unit in seconds
var dayfield=Math.floor(timediff/oneDay)
var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour)
var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute)
var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute))
if (this.baseunit=="hours"){ //if base unit is hours, set "hourfield" to be topmost level
hourfield=dayfield*24+hourfield
dayfield="n/a"
}
else if (this.baseunit=="minutes"){ //if base unit is minutes, set "minutefield" to be topmost level
minutefield=dayfield*24*60+hourfield*60+minutefield
dayfield=hourfield="n/a"
}
else if (this.baseunit=="seconds"){ //if base unit is seconds, set "secondfield" to be topmost level
var secondfield=timediff
dayfield=hourfield=minutefield="n/a"
}
var result={days: dayfield, hours:hourfield, minutes:minutefield, seconds:secondfield}
this.oncountup(result)
setTimeout(function(){thisobj.start()}, 1000) //update results every second
}
</script>
</head>
<body>
<div id="cpcontainer"> </div>
<script type="text/javascript">
//SYNTAX: myvariable=new dcountup(past_date_and_time_string, "baseunit")
var princewedding=new dcountup("April 9, 2005 13:30:00", "seconds")
princewedding.oncountup=function(result){
//result is an object containing the current count up date/time, updated every second
//Available properties: result["days"], result["hours"], result["minutes"], and result["seconds"]
var mycountainer=document.getElementById("cpcontainer")
mycountainer.innerHTML="Prince Charles and Camilla Parker have been married for: <br /><span class='dcountstyle'>"+result['seconds']+" <sup>seconds</sup></span>"
}
</script>
</body>
</html>
__________________
Software | Yakible | U.S.$5 Domains | FriendTEK | Arcontica | Maypajo| www.deskromance.com | Forums| Unfolds Videos | WebTor| Url Shortener| 25%discount| Free Hosting Blogs| | Web Directory| Weblord's Community| Freebies| Post To Host | Cash Surf | Funny Jokes | www.bloghaven.org | Videos | Videos |
|
|
|
|
|
#8 (permalink) |
|
New Hunter
Join Date: Dec 2007
Location: United Kingdom - Dorset - Bournemouth
Posts: 85
iTrader: 0 / 0%
Hunter Bux: 5.00
![]() ![]() |
PHP then - Unlike the JS one, this is not my script, can't remember where I got it from:
PHP Code:
__________________
<!-- I can type the entire Alphabet in 2.19 seconds --> /* (X/D)Html, Css, Javascript, Ajax, Xml (DTD), PHP, MySQL, E4X */ /* Learning C++ and German */ Last edited by Smiggy; 02-16-2008 at 07:31 AM. |
|
|
|
|
|
#9 (permalink) |
|
New Hunter
Join Date: Dec 2007
Location: United Kingdom - Dorset - Bournemouth
Posts: 85
iTrader: 0 / 0%
Hunter Bux: 5.00
![]() ![]() |
Why wont it show you the $ thingys when you put them together??
__________________
<!-- I can type the entire Alphabet in 2.19 seconds --> /* (X/D)Html, Css, Javascript, Ajax, Xml (DTD), PHP, MySQL, E4X */ /* Learning C++ and German */ Last edited by Smiggy; 02-16-2008 at 07:32 AM. |
|
|
|
|
|
#11 (permalink) |
|
New Hunter
Join Date: Dec 2007
Location: United Kingdom - Dorset - Bournemouth
Posts: 85
iTrader: 0 / 0%
Hunter Bux: 5.00
![]() ![]() |
If you look at the PHP counter coding I did, I had to make a space in between the $ and the word otherwise it would disapear...Why???
__________________
<!-- I can type the entire Alphabet in 2.19 seconds --> /* (X/D)Html, Css, Javascript, Ajax, Xml (DTD), PHP, MySQL, E4X */ /* Learning C++ and German */ |
|
|
|
|
|
#12 (permalink) | |
|
Field Master
|
Quote:
__________________
My Tech Blog |
|
|
|
|
|
|
#13 (permalink) |
|
New Hunter
Join Date: Dec 2007
Location: United Kingdom - Dorset - Bournemouth
Posts: 85
iTrader: 0 / 0%
Hunter Bux: 5.00
![]() ![]() |
No Problem.
__________________
<!-- I can type the entire Alphabet in 2.19 seconds --> /* (X/D)Html, Css, Javascript, Ajax, Xml (DTD), PHP, MySQL, E4X */ /* Learning C++ and German */ |
|
|
|
|
|
#15 (permalink) |
|
New Hunter
|
Free Hit Counters with or without Statistics - track everything about your visitors with our free hit counter.
visit this sites i found the best site................ enjoy it ![]() |
|
|
|
|
|
#16 (permalink) | |
|
Senior Moderator
|
Quote:
echo"$ count"; If you mean that, you can get rid of the space between it. If you don't mean that, specify which line you are talking about so I can parse it correctly :D. It shouldn't be a variable if you have a space. EDIT: Looking at the code, the variable was defined this way $ count So if you want to call it, you must put a space. Hope that helped.
__________________
+-(X)HTML, CSS, JavaScript, SEO, PHP, Flash-+ Code:
<style type="text/css"> u { text-decoration: none; } </style>
Last edited by SpOrTsDuDe.Reese; 04-11-2008 at 06:10 AM. Reason: Noticed the variable thing |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|