Parašė Woo-2· 2007 Lap. 3 20:11:12
#7
negi man gaila :D
opentable("Tinklapio gyvavimo laikas");
?>
<script type="text/javascript">
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(){}
dcountup.prototype.start=function(){
var thisobj=this
this.currentTime.setSeconds(this.currentTime.getSeconds()+1)
var timediff=(this.currentTime-this.startingdate)/1000
var oneMinute=60
var oneHour=60*60
var oneDay=60*60*24
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"){
hourfield=dayfield*24+hourfield
dayfield="n/a"
}
else if (this.baseunit=="minutes"){
minutefield=dayfield*24*60+hourfield*60+minutefield
dayfield=hourfield="n/a"
}
else if (this.baseunit=="seconds"){
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)
}
</script>
</head>
<body>
<div id="cpcontainer"></div>
<script type="text/javascript">
//SYNTAX:myvariable=new dcountup(past_date_and_time_string, "baseunit")
//NUO KADA SKAIČIUOT
var princewedding=new dcountup("November 3, 2007 18:21:00", "days")
princewedding.oncountup=function(result){
var mycountainer=document.getElementById("cpcontainer")
mycountainer.innerHTML="<br />"+result['days']+" d, "+result['hours']+" h, "+result['minutes']+" min, "+result['seconds']+" s: Nuo scripto publikavimo xD"
}
</script>
</body>
</html>
<?
closetable();