如何将这段代码中的文本更改为白色? [英] how to change the text in this code to appear as white ?

查看:124
本文介绍了如何将这段代码中的文本更改为白色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在做一个网站项目,想寻求帮助.


我的代码显示为黑色,但我希望它为白色.我该怎么办?

这是我的下面的代码

Hi everybody,

I am working on a website project , and would like to ask for assistance.


My code appears black but I would like it to be white. How can I do it ?

Here is my code below

<script type="text/javascript">
   var now = new Date();
   var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
   var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
   var date = ((now.getDate() < 10) ? "0" : "") + now.getDate();
   var year = (now.getYear() < 1000) ? now.getYear() + 1900 : now.getYear();
   today = days[now.getDay()] + ", " + months[now.getMonth()] + " " + date + ", " + year;
   var basicdate = document.getElementById('basicdate');
   basicdate.innerHTML = today;
</script>







Can somebody help me?

推荐答案

您需要将basicdate字段的颜色样式属性设置为white

You need to set the basicdate field''s color style attribute to white

<input type="text" style="color:#ffffff" id="basicdate">
</input>


HTML中的某处有一个元素,其ID等于"basicdate":
Somewhere in your HTML there is an element with an id equal to "basicdate":
<div id="basicdate"></div>



您的不必一定是div,而可以是可以围绕某些内容的任何标签.剩下要做的就是对其应用某种样式,以使文本显示为白色:



Yours mustn''t nescessarily be a div, but could rather be any tag that can surround some content. All that''s left to do is to apply some style to it in order to make the text appear as white:

<div id="basicdate" style="color: #FFFFFF;"></div>




or

<div id="basicdate" style="color: white;"></div>



或更好地使用样式表.为简单起见,我将使用嵌入在页面中的样式表对此进行演示:



or better yet use style sheets. For simplicity I''ll demonstrate this with a style sheet that is embedded in the page:

<html>
<head>
    <style type="text/stylesheet">
    #basicdate {
        color: #FFFFFF;
    }
    </style>
</head>
<body>
...
<div id="basicdate"></div>
...
</body>
</html>



希望对您有所帮助!

问候,
曼弗雷德(Manfred)



Hope that helps!

Regards,
Manfred


这篇关于如何将这段代码中的文本更改为白色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆