Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: laiko skaičiavimas
Parašė _Tomas· 2008 Bir. 13 23:06:51
#1
suradau skriptų bibliotekoj laiko skaičiavima
<SCRIPT LANGUAGE="JAVASCRIPT">
today = new Date();
BigDay = new Date("December 21, 2007")
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
document.write( "(Liko iki svetes:) "+daysLeft+"</b> dienų, <b>"+hrsLeft+"</b> valandų ir <b>"+minsLeft+"</b> min.");
</SCRIPT>
Ir galit padėt iterpti sekundes. :D
Nes kiek bandžiau pridėti dingdavo visas tekstas ir nieko :||||
Redagavo _Tomas· 2008 Rugs. 25 13:09:31
Parašė Acer· 2008 Bir. 14 08:06:48
#2
<SCRIPT LANGUAGE="JAVASCRIPT">
today = new Date();
BigDay = new Date("December 21, 2007")
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
e_minsLeft = Math.floor((e_hfrLeft - hrsLeft)*60);
minLeft = Math.floor(e_minLeft);
secLeft = Math.floor((e_minLeft - minLeft)*60);
document.write( "(Liko iki svetes:) "+daysLeft+"</b> dienų, <b>"+hrsLeft+"</b> valandų ir <b>"+minsLeft+"</b> min. <b>"+secLeft+"</b> sec.");
Pabandyk, tingėjau tikrinti.
</SCRIPT>
Redagavo Acer· 2008 Bir. 14 08:06:03
Parašė _Tomas· 2008 Rugs. 25 13:09:25
#3
Yo. senoka tema, bet reikia pagalbos iterpti sekundes nes nieko nesigauna, pakėliau temą nes nenorėjau kitos kurti.
minLeft = Math.floor(e_minLeft);
secLeft = Math.floor((e_minLeft - minLeft)*60);
Šitas neveikia
Parašė WantedBoy· 2008 Rugs. 25 14:09:34
#4
<SCRIPT LANGUAGE="JAVASCRIPT">
today = new Date();
BigDay = new Date("December 21, 2007")
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
e_minsLeft = Math.floor((e_hfrLeft - hrsLeft)*60);
minLeft = Math.floor(e_minLeft);
e_secLeft = Math.floor((e_minLeft - minLeft)*60);
secLeft = Math.floor(e_secLeft);
document.write( "(Liko iki svetes:) "+daysLeft+"</b> dienų, <b>"+hrsLeft+"</b> valandų ir <b>"+minsLeft+"</b> min. <b>"+secLeft+"</b> sec.");</SCRIPT>
Parašė _Tomas· 2008 Rugs. 25 14:09:37
#5
Neveikia. Jau šituos seniai bandžiau. Tučia panelę meta.
Parašė Žmogus· 2008 Rugs. 25 14:09:03
#6
Google gal paieškok, manau turėtum rasti :|
Parašė WantedBoy· 2008 Rugs. 25 18:09:05
#7
Turi veikt, pabandyk...
<SCRIPT LANGUAGE="JAVASCRIPT">
today = new Date();
BigDay = new Date("December 21, 2008")
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
e_minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
minsLeft = Math.floor(e_minsLeft);
e_secLeft = Math.floor((e_minsLeft - minsLeft)*60);
secLeft = Math.floor(e_secLeft);
document.write( "(Liko iki svetes:) "+daysLeft+"</b> dienų, <b>"+hrsLeft+"</b> valandų ir <b>"+minsLeft+"</b> min. <b>"+secLeft+"</b> sec.");</SCRIPT>
Redagavo WantedBoy· 2008 Rugs. 25 18:09:13
Parašė _Tomas· 2008 Rugs. 25 21:09:08
#8
Nu nerodo jau tuščio lango ir rodo sekundes, bet jos neina.
Parašė Samp_Tevas· 2008 Rugs. 25 22:09:42
#9
Kam tas laiko skaiciavimas reikalingas:?
Parašė _Tomas· 2008 Rugs. 26 13:09:35
#10
Nustatai datą pvz:
December 21, 2008
Ir rodo kiek liko iki tos dieno, rodo: Dienas, valandas, minutes o man reikia ir sekundžių kurių neišeina įdėti
Parašė WantedBoy· 2008 Rugs. 26 14:09:56
#11
Tai su šituo laikrodžiu neveiks, reikia dadėt
javaScript'ą.
Parašė _Tomas· 2008 Rugs. 26 18:09:30
#12
Tai kad čia ir taip
javascript :|.:?
Parašė Pongis· 2008 Rugs. 26 18:09:27
#13
Karoče imk kitą scriptą ir vsio:
<script language="JavaScript1.2">
function setcountdown(theyear,themonth,theday,thehour,themin,thesec){
yr=theyear;mo=themonth;da=theday;hr=thehour;min=themin;sec=thesec
}
setcountdown(2009,05,31,23,00,00)
var occasion=""
var message_on_occasion="Vasara"
var countdownwidth='520px'
var countdownheight='35px'
var countdownbgcolor=''
var opentags='<b><font face="Verdana"><normal>'
var closetags='</small></font></b>'
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
var crosscount=''
function start_countdown(){
if (document.layers)
document.countdownnsmain.visibility="show"
else if (document.all||document.getElementById)
crosscount=document.getElementById&&!document.all?document.getElementById("countdownie") : countdownie
countdown()
}
if (document.all||document.getElementById)
document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-color:'+countdownbgcolor+'"></span>')
window.onload=start_countdown
function countdown(){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
futurestring=montharray[mo-1]+" "+da+", "+yr+" "+hr+":"+min+":"+sec
dd=Date.parse(futurestring)-Date.parse(todaystring)+ 3600000
dday=Math.floor(dd/(60*60*1000*24)*1)
dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
if(dday<=0&&dhour<=0&&dmin<=0&&dsec<=1&&todayd==da){
if (document.layers){
document.countdownnsmain.document.countdownnssub.document.write(opentags+message_on_occasion+closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}
else if (document.all||document.getElementById)
crosscount.innerHTML=opentags+message_on_occasion+closetags
return
}
else if (dday<=-1){
if (document.layers){
document.countdownnsmain.document.countdownnssub.document.write(opentags+"Vasara"+closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}
else if (document.all||document.getElementById)
crosscount.innerHTML=opentags+"Vasara"+closetags
return
}
else{
if (document.layers){
document.countdownnsmain.document.countdownnssub.document.write(opentags+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+occasion+closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}
else if (document.all||document.getElementById)
crosscount.innerHTML=opentags+dday+ " dienos(-a), "+dhour+" valandų(-os), "+dmin+" minutės(-ė), "+dsec+" sekundės(-ė) "+occasion+closetags
}
setTimeout("countdown()",1000)
}
</script>
arba:
<form name="count">
<input type="text" size="69" name="count2">
</form>
<script>
//change the text below to reflect your own,
var before="Christmas!"
var current="Today is Christmas. Merry Christmas!"
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
function countdown(yr,m,d){
theyear=yr;themonth=m;theday=d
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
futurestring=montharray[m-1]+" "+d+", "+yr
dd=Date.parse(futurestring)-Date.parse(todaystring)
dday=Math.floor(dd/(60*60*1000*24)*1)
dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
if(dday==0&&dhour==0&&dmin==0&&dsec==1){
document.forms.count.count2.value=current
return
}
else
document.forms.count.count2.value="Only "+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+before
setTimeout("countdown(theyear,themonth,theday)",1000)
}
//enter the count down date using the format year/month/day
countdown(2008,12,25)
</script>
Redagavo Pongis· 2008 Rugs. 26 18:09:19