Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.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 当前日期js代码中字体颜色未更改_Javascript_Html_Css_Colors - Fatal编程技术网

Javascript 当前日期js代码中字体颜色未更改

Javascript 当前日期js代码中字体颜色未更改,javascript,html,css,colors,Javascript,Html,Css,Colors,所以我得到了一个计算当前日期的js代码,但是我不能改变字体的颜色。我尝试在CSS和html页面中进行更改。你能帮我吗 <div id="day" style="width:248px; font-color: #fff; border-top: none; border-right: none; border-left: none; padding-bottom:2px; background-color:#acd373; font-size:12px;" >

所以我得到了一个计算当前日期的js代码,但是我不能改变字体的颜色。我尝试在CSS和html页面中进行更改。你能帮我吗

<div id="day" style="width:248px; font-color: #fff; border-top: none; border-right: none; border-left: none; padding-bottom:2px; background-color:#acd373; font-size:12px;" > 

            <a style="float: left;" href="yesterday.html" > < </a>

            <script language="JavaScript" type="text/javascript">
            <!--

            var months = new Array(12);
            months[0] = "January";
            months[1] = "February";
            months[2] = "March";
            months[3] = "April";
            months[4] = "May";
            months[5] = "June";
            months[6] = "July";
            months[7] = "August";
            months[8] = "September";
            months[9] = "October";
            months[10] = "November";
            months[11] = "December";

            var current_date = new Date();
            month_value = current_date.getMonth();
            day_value = current_date.getDate();
            year_value = current_date.getFullYear();

            document.write( months[month_value] + " " +
            day_value + ", " + year_value);

            //-->
            </script>

            <a style="float: right;" href="tomorrow.html" > > </a>

        </div> 

这就是现在的样子,日期是黑色的,我想要白色的。尝试在“样式”中的div中更改,所有内容都可以正常工作,包括字体大小,但颜色除外。
添加元素以设置颜色属性

document.write("<span style='color:#fff;'>" + months[month_value] + " " + day_value + ", " + year_value+"</span>");
document.write(“+月[月值]+”+日值+”,“+年值+”);

一种更简洁(且不易出错)的数组编写方法:
var months=[“一月”、“二月”、“三月”、“十一月”、“十二月”]我会接受你的建议,谢谢!