کد درخاستی برای ساعت و تاریخ سالم تست شده

این کد برای ساعت هست دو قسمت داره بخش اول

<span id=’lblt’></span>

بخش دوم که هر دو بخش تو قالب جا میگیره

<script type=’text/javascript’ language=’javascript’>
function showClock() {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var timeValue = ”;

timeValue += ‘ ‘ + convertToFaNo(hours);
timeValue += ((minutes < 10) ? ‘:۰’ : ‘:’) + convertToFaNo(minutes);
timeValue += ((seconds < 10) ? ‘:۰’ : ‘:’) + convertToFaNo(seconds);
document.getElementById(‘lblt’).innerHTML = timeValue;
}

function convertToFaNo(num) {
var faNumArray = new Array(11);
var strNum = String(num);
faNumArray[0] = ‘۰’;
faNumArray[1] = ‘۱’;
faNumArray[2] = ‘۲’;
faNumArray[3] = ‘۳’;
faNumArray[4] = ‘۴’;
faNumArray[5] = ‘۵’;
faNumArray[6] = ‘۶’;
faNumArray[7] = ‘۷’;
faNumArray[8] = ‘۸’;
faNumArray[9] = ‘۹’;

var opFaNum = ”;
for (var i = 0; i < strNum.length; ++i) {
opFaNum += faNumArray[strNum.substr(i, 1)];
}

return opFaNum;
}

showClock();
setInterval(‘showClock()’, 1000);
</script>

و برای تاریخ هم اینو بزارین کد

<script type=’text/javascript’ language=’javascript’>

function showdate() {
week= new Array(“یکشنبه”,”دوشنبه”,”سه شنبه”,”چهارشنبه”,”پنج شنبه”,”جمعه”,”شنبه”)
months = new Array(“فروردین”,”اردیبهشت”,”خرد� �د”,”تیر”,”مرداد”,”شهریور”,”مهر” ,”آبان”,”آذر”,”دی”,”بهمن”,”اسفند “);
a = new Date();
d= a.getDay();
day= a.getDate()+0;
month = a.getMonth()+1;
year= a.getYear();

year = (year== 0)?2000:year;
(year<1000)? (year += 2000):true;

year = 1393;

switch (month) {
case 1: (day<21)? (month=10, day+=10):(month=11, day-=20); break;
case 2: (day<20)? (month=11, day+=11):(month=12, day-=19); break;
case 3: (day<21)? (month=12, day+=9):(month=1, day-=20); break;
case 4: (day<21)? (month=1, day+=11):(month=2, day-=20); break;
case 5:
case 6: (day<22)? (month-=3, day+=10):(month-=2, day-=21); break;
case 7:
case 8:
case 9: (day<23)? (month-=3, day+=9):(month-=2, day-=22); break;
case 10:(day<23)? (month=7, day+=8):(month=8, day-=22); break;
case 11:
case 12:(day<22)? (month-=3, day+=9):(month-=2, day-=21); break;
default: break;
}
document.write(‘<span style=”text-decoration: none”>’ + week[d]+” “+day+” “+months[month-1]+” “+ year + ‘</span>’);
};

showdate();
</script>

من ترکیبش کردم براش رنگ دادم و فونتشم بزرگ کردم تا ۲۰ و ترکیب دوتاش شده این کد و تست کردم سالمه

<div align=”center”><font color=”green” style=”font-family:tahoma;font-size:20px”>

<script type=’text/javascript’ language=’javascript’>

function showdate() {
week= new Array(“یکشنبه”,”دوشنبه”,”سه شنبه”,”چهارشنبه”,”پنج شنبه”,”جمعه”,”شنبه”)
months = new Array(“فروردین”,”اردیبهشت”,”خرد� �د”,”تیر”,”مرداد”,”شهریور”,”مهر” ,”آبان”,”آذر”,”دی”,”بهمن”,”اسفند “);
a = new Date();
d= a.getDay();
day= a.getDate()+0;
month = a.getMonth()+1;
year= a.getYear();

year = (year== 0)?2000:year;
(year<1000)? (year += 2000):true;

year = 1393;

switch (month) {
case 1: (day<21)? (month=10, day+=10):(month=11, day-=20); break;
case 2: (day<20)? (month=11, day+=11):(month=12, day-=19); break;
case 3: (day<21)? (month=12, day+=9):(month=1, day-=20); break;
case 4: (day<21)? (month=1, day+=11):(month=2, day-=20); break;
case 5:
case 6: (day<22)? (month-=3, day+=10):(month-=2, day-=21); break;
case 7:
case 8:
case 9: (day<23)? (month-=3, day+=9):(month-=2, day-=22); break;
case 10:(day<23)? (month=7, day+=8):(month=8, day-=22); break;
case 11:
case 12:(day<22)? (month-=3, day+=9):(month-=2, day-=21); break;
default: break;
}
document.write(‘<span style=”text-decoration: none”>’ + week[d]+” “+day+” “+months[month-1]+” “+ year + ‘</span>’);
};

showdate();
</script>

&nbsp;&nbsp;|&nbsp;&nbsp;<span id=’lblt’></span>

</font></div>

<script type=’text/javascript’ language=’javascript’>
function showClock() {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var timeValue = ”;

timeValue += ‘ ‘ + convertToFaNo(hours);
timeValue += ((minutes < 10) ? ‘:۰’ : ‘:’) + convertToFaNo(minutes);
timeValue += ((seconds < 10) ? ‘:۰’ : ‘:’) + convertToFaNo(seconds);
document.getElementById(‘lblt’).innerHTML = timeValue;
}

function convertToFaNo(num) {
var faNumArray = new Array(11);
var strNum = String(num);
faNumArray[0] = ‘۰’;
faNumArray[1] = ‘۱’;
faNumArray[2] = ‘۲’;
faNumArray[3] = ‘۳’;
faNumArray[4] = ‘۴’;
faNumArray[5] = ‘۵’;
faNumArray[6] = ‘۶’;
faNumArray[7] = ‘۷’;
faNumArray[8] = ‘۸’;
faNumArray[9] = ‘۹’;

var opFaNum = ”;
for (var i = 0; i < strNum.length; ++i) {
opFaNum += faNumArray[strNum.substr(i, 1)];
}

return opFaNum;
}

showClock();
setInterval(‘showClock()’, 1000);
</script>