Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/420.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在javascript日历中显示当前日期突出显示_Javascript - Fatal编程技术网

如何在javascript日历中显示当前日期突出显示

如何在javascript日历中显示当前日期突出显示,javascript,Javascript,我在日历中突出显示当前日期时遇到问题,我将我的代码附在了这一页上 <script language="javascript"> <!-- // fill the month table with column headings function day_title(day_name){ document.write("<TD ALIGN=center WIDTH=35>"+day_name+"</TD>") }

我在日历中突出显示当前日期时遇到问题,我将我的代码附在了这一页上

<script language="javascript">
    <!--
    // fill the month table with column headings
    function day_title(day_name){
    document.write("<TD ALIGN=center WIDTH=35>"+day_name+"</TD>")
    }
    // fills the month table with numbers
    function fill_table(month,month_length)
    { 
    day=1
    // begin the new month table
    document.write("<TABLE BORDER=3 CELLSPACING=3 CELLPADDING=%3><TR>")
    document.write("<TD COLSPAN=7 ALIGN=center><B>"+month+"   "+year+"</B><TR>")
    // column headings
    day_title("Sun")
    day_title("Mon")
    day_title("Tue")
    day_title("Wed")
    day_title("Thu")
    day_title("Fri")
    day_title("Sat")
    // pad cells before first day of month
    document.write("</TR><TR>")
    for (var i=1;i<start_day;i++){
    document.write("<TD>")
    }
    // fill the first week of days
    for (var i=start_day;i<8;i++){
    document.write("<TD ALIGN=center>"+day+"</TD>")
    day++
    }
    document.write("<TR>")
    // fill the remaining weeks
    while (day <= month_length) {
    for (var i=1;i<=7 && day<=month_length;i++){
    document.write("<TD ALIGN=center>"+day+"</TD>")
    day++
    }
    document.write("</TR><TR>")
    // the first day of the next month
    start_day=i
    }
    document.write("</TR></TABLE><BR>")
    }
    // end hiding -->

    </script>

    <script language="javascript">

    // CAHNGE the below variable to the CURRENT YEAR
    var d = new Date();
    var n = d.getFullYear();

    year=n

    var leap = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
    var add = 0;
    if(leap == true ){
    add = 1;
    }
    //alert(add);


    // first day of the week of the new year
    today= new Date("January 1, "+year)
    start_day = today.getDay() + 1   // starts with 0
    fill_table("January",31)
    fill_table("February",28+add)
    fill_table("March",31)
    fill_table("April",30)
    fill_table("May",31)
    fill_table("June",30)
    fill_table("July",31)
    fill_table("August",31)
    fill_table("September",30)
    fill_table("October",31)
    fill_table("November",30)
    fill_table("December",31)
    </script>

//将以下变量计入本年度
var d=新日期();
var n=d.getFullYear();
年份=n
var leap=((第%4年==0)和&(第%100年!=0))| |(第%400年==0);
var-add=0;
如果(leap==真){
加法=1;
}
//警报(添加);
//新年一周的第一天
今天=新日期(“1月1日,+年”)
start_day=today.getDay()+1//以0开头
填写表格(“1月”,31日)
填写表格(“2月”,28日+增补)
填写表格(“3月31日”)
填写表格(“4月”,30日)
填写表格(“5月31日”)
填写表格(“6月”,30日)
填写表格(“7月31日”)
填写表格(“8月”,31日)
填写表格(“9月”,30日)
填写表格(“10月31日”)
填写表格(“11月”,30日)
填写表格(“12月31日”)
在这个日历中,我想突出显示当前日期,如何显示?
谢谢

您可以使用日期选择器功能

谢谢你的回复。我不想使用日期选择器…我想用此代码完成此功能请从此代码编辑