Javascript'ten anlayan bakabilir mi

  • Konuyu başlatan ghost-tr
  • Başlangıç tarihi
G

ghost-tr

Kodda nerede hata var javascript kısmındaki sorunu çözebilen var mı tek yapmak istediğim verilen tarihten ileri doğru saydırmak ve yıl ay gün saat dakika şeklinde çıktı almak yardımcı olursanız sevinirim. Teşekkürler :)

HTML:
<html>
<head>
<script>
window.onload=function() {
  // Month,Day,Year,Hour,Minute,Second
  upTime('jan,01,2015,00:00:00'); // ****** Change this line!
};
function upTime(countTo) {
  now = new Date();
  countTo = new Date(countTo);
  difference = (now-countTo);
  days=Math.floor(difference/(60*60*1000*24)*1);
  years = Math.floor(days / 365);
  if (years > 1){ days = days - (years * 365)}
  hours=Math.floor((difference%(60*60*1000*24))/(60*60*1000)*1);
  month =Math.floor((months / 12);
if (months > 1){ days = days - (months * 12)}
mins=Math.floor(((difference%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
  secs=Math.floor((((difference%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);
  document.getElementById('years').firstChild.nodeValue = years;
  document.getElementById('months').firstChild.nodeValue = months;

document.getElementById('days').firstChild.nodeValue = days;
  document.getElementById('hours').firstChild.nodeValue = hours;
  document.getElementById('minutes').firstChild.nodeValue = mins;
  document.getElementById('seconds').firstChild.nodeValue = secs;

  clearTimeout(upTime.to);
  upTime.to=setTimeout(function(){ upTime(countTo); },1000);
}
</script>

<style  type="text/css">

//Buraya Css Kodları Gelecek
#countup p {
display: inline-block;
padding: 5px;
background: #FFA500;
margin: 0 0 20px;
}
</style>
</head>
<body>
It's been
  <p id="years">00</p>
  <p class="timeRefYears">years</p>
  <p id="days">00</p>
<p class="timeRefMonths">months </p>
<p id="months">00 </p>
  <p class="timeRefDays">days</p>
  <p id="hours">00</p>
  <p class="timeRefHours">hours</p>
  <p id="minutes">00</p>
  <p class="timeRefMinutes">minutes</p>
  <p id="seconds">00</p>
  <p class="timeRefSeconds">second</p>
</body>
</html>
 

r3n4m3

Backend Developer
Katılım
3 Ara 2015
Tepki puanı
673
Rating - 0%
HTML:
<html>
<head>
<title>Your Page Name</title>
<SCRIPT LANGUAGE="JavaScript">

<!--

var Temp2;
var timerID = null;
var timerRunning = false;
function arry() {
this.length = 12;
this[0] = 31;
this[1] = 28;
this[2] = 31;
this[3] = 30;
this[4] = 31;
this[5] = 30;
this[6] = 31;
this[7] = 31;
this[8] = 30;
this[9] = 31;
this[10] = 30;
this[11] = 31;
}
var date = new arry();

function stopclock() {
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}

function startclock() {
stopclock();
showtime();
}

function showtime() {
now = new Date();
var CurMonth = now.getMonth();
var CurDate = now.getDate();
var CurYear = now.getFullYear();
now = null;
if (31 < CurDate) {
CurDate -= date[CurMonth]; CurMonth++;
}
if (11 < CurMonth) {
CurMonth -= 12; CurYear++;
}

var Yearleft = 2016 - CurYear;
var Monthleft = 11 - CurMonth;
var Dateleft = 31 - CurDate;

document.dateform.a.value = Yearleft;
document.dateform.b.value = Monthleft;
document.dateform.c.value = Dateleft;

timerID = setTimeout("showtime()",1000);
timerRunning = true;
}

// -->
</script>
</head>
<body Onload="startclock();">
<form name="dateform">
<!-- This code generated at www.csgnetwork.com/ymdcountdowngen.html. -->
Only <input type="text" name="a" size="2" value=""> years,
<input type="text" name="b" size="2" value=""> months, and
<input type="text" name="c" size="2" value=""> days left until 12/31/2016
</form>
<!-- The content of your HTML document begins here. -->
</body>
</html>

Belki yardımcı olur
 
131,552Konular
3,269,155Mesajlar
315,389Kullanıcılar
Üst Alt