thelw ena javascript coutdouwn

Κώδικας, πληροφορίες, ερωτήσεις και απαντήσεις σχετικές με την JavaScript.

Συντονιστές: WebDev Moderators, Super-Moderators

Απάντηση
NDH
Δημοσιεύσεις: 403
Εγγραφή: 03 Φεβ 2009 13:56
Επικοινωνία:

thelw ena javascript coutdouwn

Δημοσίευση από NDH » 20 Φεβ 2010 14:50

geia sas pedia tha ithela an fysika exete kati se etoimo ipopsin ena script pou na pernei 3 metavlites var hours, var minutes, kai var seconds kai na kanei antistrofi metrisi apo tis times pou tha dinw ews to 00:00:00.
euxaritw!

Joakim
Δημοσιεύσεις: 441
Εγγραφή: 06 Ιουν 2004 13:48

thelw ena javascript coutdouwn

Δημοσίευση από Joakim » 20 Φεβ 2010 17:56

NDH έγραψε:geia sas pedia tha ithela an fysika exete kati se etoimo ipopsin ena script pou na pernei 3 metavlites var hours, var minutes, kai var seconds kai na kanei antistrofi metrisi apo tis times pou tha dinw ews to 00:00:00.
euxaritw!
tha mporouses na kanis ena aplo search sto google, exi polla script... ena apo afta ine to akoloutho

Κώδικας: Επιλογή όλων

<form name="count">
<input type="text" size="69" name="count2">
</form>


<script>

/*
Count down until any date script-
By JavaScript Kit &#40;www.javascriptkit.com&#41;
Over 200+ free scripts here!
*/


//change the text below to reflect your own,
var before="Christmas!"
var current="Today is Christmas. Merry Christmas!"
var montharray=new Array&#40;"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"&#41;

function countdown&#40;yr,m,d&#41;&#123;
theyear=yr;themonth=m;theday=d
var today=new Date&#40;&#41;
var todayy=today.getYear&#40;&#41;
if &#40;todayy < 1000&#41;
todayy+=1900
var todaym=today.getMonth&#40;&#41;
var todayd=today.getDate&#40;&#41;
var todayh=today.getHours&#40;&#41;
var todaymin=today.getMinutes&#40;&#41;
var todaysec=today.getSeconds&#40;&#41;
var todaystring=montharray&#91;todaym&#93;+" "+todayd+", "+todayy+" "+todayh+"&#58;"+todaymin+"&#58;"+todaysec
futurestring=montharray&#91;m-1&#93;+" "+d+", "+yr
dd=Date.parse&#40;futurestring&#41;-Date.parse&#40;todaystring&#41;
dday=Math.floor&#40;dd/&#40;60*60*1000*24&#41;*1&#41;
dhour=Math.floor&#40;&#40;dd%&#40;60*60*1000*24&#41;&#41;/&#40;60*60*1000&#41;*1&#41;
dmin=Math.floor&#40;&#40;&#40;dd%&#40;60*60*1000*24&#41;&#41;%&#40;60*60*1000&#41;&#41;/&#40;60*1000&#41;*1&#41;
dsec=Math.floor&#40;&#40;&#40;&#40;dd%&#40;60*60*1000*24&#41;&#41;%&#40;60*60*1000&#41;&#41;%&#40;60*1000&#41;&#41;/1000*1&#41;
if&#40;dday==0&&dhour==0&&dmin==0&&dsec==1&#41;&#123;
document.forms.count.count2.value=current
return
&#125;
else
document.forms.count.count2.value="Only "+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+before
setTimeout&#40;"countdown&#40;theyear,themonth,theday&#41;",1000&#41;
&#125;
//enter the count down date using the format year/month/day
countdown&#40;2002,12,25&#41;
</script>
<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http&#58;//javascriptkit.com">JavaScript
Kit</a></font></p>
Iparxoun dio leptomeries pou prepi na alla3is... vres ston kodika tin parakato parathesi kai alla3e tin imerominia, Xronos,Minas,Imera

Κώδικας: Επιλογή όλων

countdown&#40;2003,12,25&#41;
Epita alla3ete tis lezantes, prin tin mera pou thelis kai to minima kata tin diarkia aftis

Κώδικας: Επιλογή όλων

var before="Christmas!"
var current="Today is Christmas. Merry Christmas!"

NDH
Δημοσιεύσεις: 403
Εγγραφή: 03 Φεβ 2009 13:56
Επικοινωνία:

thelw ena javascript coutdouwn

Δημοσίευση από NDH » 20 Φεβ 2010 18:23

vasika exw psaksei arketa exw vrei kapoia alla den mou kanoun opos to parapanw pou edwses egw thelw gia wres lepta kai deuterolepta kai oxi imerominies thelw kati san auto parakatw alla na exei kai wres oxi mono lepta kai deuterolepta

Κώδικας: Επιλογή όλων

var sec = 30;   // set the seconds
var min = 02;   // set the minutes

function countDown&#40;&#41; &#123;
  sec--;
  if &#40;sec == -01&#41; &#123;
    sec = 59;
    min = min - 1;
  &#125; else &#123;
   min = min;
  &#125;
if &#40;sec<=9&#41; &#123; sec = "0" + sec; &#125;
  time = &#40;min<=9 ? "0" + min &#58; min&#41; + " min and " + sec + " sec ";
if &#40;document.getElementById&#41; &#123; theTime.innerHTML = time; &#125;
  SD=window.setTimeout&#40;"countDown&#40;&#41;;", 1000&#41;;
if &#40;min == '00' && sec == '00'&#41; &#123; sec = "00"; window.clearTimeout&#40;SD&#41;; &#125;
&#125;

function addLoadEvent&#40;func&#41; &#123;
  var oldonload = window.onload;
  if &#40;typeof window.onload != 'function'&#41; &#123;
    window.onload = func;
  &#125; else &#123;
    window.onload = function&#40;&#41; &#123;
      if &#40;oldonload&#41; &#123;
        oldonload&#40;&#41;;
      &#125;
      func&#40;&#41;;
    &#125;
  &#125;
&#125;

addLoadEvent&#40;function&#40;&#41; &#123;
  countDown&#40;&#41;;
&#125;&#41;;

Κώδικας: Επιλογή όλων

<table width="100%">
 <tr><td width="100%" align="center"><span id="theTime" class="timeClass"></span></td></tr>
</table>

Joakim
Δημοσιεύσεις: 441
Εγγραφή: 06 Ιουν 2004 13:48

thelw ena javascript coutdouwn

Δημοσίευση από Joakim » 20 Φεβ 2010 18:48

Κώδικας: Επιλογή όλων

<form name="count">
<input type="text" size="69" name="count2">
</form>


<script>

/*
Count down until any date script-
By JavaScript Kit &#40;www.javascriptkit.com&#41;
Over 200+ free scripts here!
*/


//change the text below to reflect your own,
var before="Christmas!"
var current="Today is Christmas. Merry Christmas!"
var montharray=new Array&#40;"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"&#41;

function countdown&#40;yr,m,d&#41;&#123;
theyear=yr;themonth=m;theday=d
var today=new Date&#40;&#41;
var todayy=today.getYear&#40;&#41;
if &#40;todayy < 1000&#41;
todayy+=1900
var todaym=today.getMonth&#40;&#41;
var todayd=today.getDate&#40;&#41;
var todayh=today.getHours&#40;&#41;
var todaymin=today.getMinutes&#40;&#41;
var todaysec=today.getSeconds&#40;&#41;
var todaystring=montharray&#91;todaym&#93;+" "+todayd+", "+todayy+" "+todayh+"&#58;"+todaymin+"&#58;"+todaysec
futurestring=montharray&#91;m-1&#93;+" "+d+", "+yr
dd=Date.parse&#40;futurestring&#41;-Date.parse&#40;todaystring&#41;
dday=Math.floor&#40;dd/&#40;60*60*1000*24&#41;*1&#41;
dhour=Math.floor&#40;&#40;dd%&#40;60*60*1000*24&#41;&#41;/&#40;60*60*1000&#41;*1&#41;
dmin=Math.floor&#40;&#40;&#40;dd%&#40;60*60*1000*24&#41;&#41;%&#40;60*60*1000&#41;&#41;/&#40;60*1000&#41;*1&#41;
dsec=Math.floor&#40;&#40;&#40;&#40;dd%&#40;60*60*1000*24&#41;&#41;%&#40;60*60*1000&#41;&#41;%&#40;60*1000&#41;&#41;/1000*1&#41;
if&#40;dday==0&&dhour==0&&dmin==0&&dsec==1&#41;&#123;
document.forms.count.count2.value=current
return
&#125;
else
document.forms.count.count2.value="Only "+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+before
setTimeout&#40;"countdown&#40;theyear,themonth,theday&#41;",1000&#41;
&#125;
//enter the count down date using the format year/month/day
countdown&#40;2002,12,25&#41;
</script>
<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http&#58;//javascriptkit.com">JavaScript
Kit</a></font></p>

Joakim
Δημοσιεύσεις: 441
Εγγραφή: 06 Ιουν 2004 13:48

thelw ena javascript coutdouwn

Δημοσίευση από Joakim » 20 Φεβ 2010 18:49


NDH
Δημοσιεύσεις: 403
Εγγραφή: 03 Φεβ 2009 13:56
Επικοινωνία:

thelw ena javascript coutdouwn

Δημοσίευση από NDH » 20 Φεβ 2010 19:24

vasika apo javascript den kserw kai para pola aposa katalavenw omos den kserw pos na to kanw san auto pou lew

Joakim
Δημοσιεύσεις: 441
Εγγραφή: 06 Ιουν 2004 13:48

thelw ena javascript coutdouwn

Δημοσίευση από Joakim » 20 Φεβ 2010 19:48

file an se afto to scriptaki pou sou edosa

Κώδικας: Επιλογή όλων

countdown&#40;2002,12,25&#41; 
to alla3is kai valis imerominia Px tin epomeni mera otan to sinolo ton oron einai -24 ores tote den tha sou vgazi imeres , tha grafi 0. to zitoumeno sou afto ine , exis ores exis lepta kai deftera... an tora se enoxli pou exi meres kai tha itheles na grafi px. apomenoun 78 ores anti 3 meres 6 ores tote alla3e ta var. tou script i psa3e gia hour countdown sto google, alla kati tetio isos na ginete refresh kai na 3ekina apo tin arxi otan kapios anigi to site

NDH
Δημοσιεύσεις: 403
Εγγραφή: 03 Φεβ 2009 13:56
Επικοινωνία:

thelw ena javascript coutdouwn

Δημοσίευση από NDH » 20 Φεβ 2010 19:53

vasika egw exw ena scriptaki php opou leei periseuoun px 3:30:10 wres (to apotelesma den thane pote panw apo 24 wres ) exw psaksei auto pou les alla ola exoun day i den exoun hours

Joakim
Δημοσιεύσεις: 441
Εγγραφή: 06 Ιουν 2004 13:48

thelw ena javascript coutdouwn

Δημοσίευση από Joakim » 22 Φεβ 2010 03:25

lipon to akoloutho ine ena aplo counterdown to opio omos ananeonete me to pou mpenis sto site

Κώδικας: Επιλογή όλων

<form name="counter"><input type="text" size="8" 
name="d2"></form> 

<script> 
<!-- 
// 
 var milisec=0 
 var seconds=30     &#40;// alla3e to afto sta deftera pou thes
 document.counter.d2.value='30' 

function display&#40;&#41;&#123; 
 if &#40;milisec<=0&#41;&#123; 
    milisec=9 
    seconds-=1 
 &#125; 
 if &#40;seconds<=-1&#41;&#123; 
    milisec=0 
    seconds+=1 
 &#125; 
 else 
    milisec-=1 
    document.counter.d2.value=seconds+"."+milisec 
    setTimeout&#40;"display&#40;&#41;",100&#41; 
&#125; 
display&#40;&#41; 
--> 
</script> 

Κώδικας: Επιλογή όλων

var seconds=30     &#40;// alla3e to afto sta deftera pou thes
i des kai edo http://www.dynamicdrive.com/dynamicinde ... ntdown.htm

Απάντηση

Επιστροφή στο “JavaScript και Frameworks”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες