I would like to have two clocks on my website: one with local time, other with GMT+1. Everything works when i use the codes separetly, but when together, only second one works. What have I done wrong?
<div id="clockbox2" style="height: 100%px; width: 100%; color:#fff">
<script type="text/javascript">
tday=new Array("воскресение","понедельник","вторник","среда","четверг","пятница","суббота");
tmonth=new Array("января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря");
function GetClock(){
var d=new Date();
var nday=d.getDay(),nmonth=d.getMonth(),ndate=d.getDate(),nyear=d.getYear();
if(nyear<1000) nyear+=1900;
var nhour=d.getHours(),nmin=d.getMinutes();
if(nmin<=9) nmin="0"+nmin
document.getElementById('clockbox').innerHTML="<br>"+nhour+":"+nmin+"<br>"+tday[nday]+", "+ndate+" "+tmonth[nmonth]+", "+nyear+" г.";
}
window.onload=function(){
GetClock();
setInterval(GetClock,1000);
}
</script>
</div>
<div id="clockbox2" style="height: 100%px; width: 100%; color:#fff">
<script type="text/javascript">
tday=new Array("воскресение","понедельник","вторник","среда","четверг","пятница","суббота");
tmonth=new Array("января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря");
function GetClock2(){
var tzOffset = -5;//set this to the number of hours offset from UTC
var d=new Date();
var dx=d.toGMTString();
dx=dx.substr(0,dx.length -3);
d.setTime(Date.parse(dx))
d.setHours(d.getHours()+tzOffset);
var nday=d.getDay(),nmonth=d.getMonth(),ndate=d.getDate(),nyear=d.getYear();
if(nyear<1000) nyear+=1900;
var nhour=d.getHours(),nmin=d.getMinutes();
if(nmin<=9) nmin="0"+nmin
document.getElementById('clockbox2').innerHTML="<br>"+nhour+":"+nmin+"<br>"+tday[nday]+", "+ndate+" "+tmonth[nmonth]+", "+nyear+" г.";
}
window.onload=function(){
GetClock2();
setInterval(GetClock2,1000);
}
</script>
</div>