我想製作一個包含陽曆和伊斯蘭日期的日曆,我只是粗略編碼的陽曆,但是我不知道如何包含伊斯蘭日期這一點,可以在任何一個,請給我的想法是如何使這個如何製作陽曆和伊斯蘭日曆中的一個(javascript)
我要讓日曆這樣 http://www.islamicfinder.org/Hcal/index.php
我的代碼是:
function Calendar()
{
var now=new Date();
//---------------current date and time------------------
var day=now.getDate();
var month=now.getMonth()+1;
var year=now.getFullYear();
//-----------------------------------------------------
var FirstDay=new Date(now.getFullYear(),now.getMonth(),1);
var dayOne=FirstDay.getDay();
var LastDay=new Date(now.getFullYear(),now.getMonth()+1,0);
var dayLast=LastDay.getDay();
var noDays=getMonthDays(year,month);
var abs="<table><tr><td>sun</td><td>Mon</td><td>Tue</td><td>Wed</td><td>Th</td><td>Fri</td><td>sat</td></tr><tr>";
var iterator=0;;
while(dayOne>0)
{
abs +="<td></td>"
iterator++;
dayOne--;
}
var i=1;
alert(month);
alert(year)
while(i<=noDays)
{
if(iterator>6)
{
iterator=0;
abs +="</tr><tr>"
}
abs +="<td>"+i+"</td>";
iterator++
i++;
}
var nameOfMonth=monthName(month);
document.getElementById("head").innerHTML="<h1>"+nameOfMonth+"</h1>";
document.getElementById("tble").innerHTML=abs;
}
function getMonthDays(iyear,imonth)
{
if (((iyear % 4)==0) && ((iyear % 100)!=0) || ((iyear % 400)==0))
{
var days=new Array(0,31,29,31,30,31,30,31,31,30,31,30,31);
return days[imonth];
}
else
{
var days=new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);
return days[imonth];
}
}
function monthName(m)
{
var months=new Array("nill","January","February","March","April","May","June","July","August","September","October","November","December");
//alert(months[m]);
return months[m];
}