Nanowatt
Nanowatt

Reputation: 33

Font color not changing in current date js code

So I got a js code that calculated the current date, but I can't change the color of the font. I've tried to change in CSS and in the html page. Can you help me?

<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> 

This is how it looks now, the date is in black, and I wanted white. Tried to change in div in "style", everything works including font-size, except the color. http://s30.postimg.org/azxdl1co1/Captura_de_ecr_2013_11_30_s_15_47_40.png

Upvotes: 0

Views: 1247

Answers (1)

Tom Chung
Tom Chung

Reputation: 1422

Add a element to set color property.

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

Upvotes: 1

Related Questions