Javascript 周一到周六写这行代码,周日写这行代码
基本上,我有:Javascript 周一到周六写这行代码,周日写这行代码,javascript,date,document.write,Javascript,Date,Document.write,基本上,我有: document.write('DIVS/HTML go here') 只有在星期天,我希望它是: document.write(' ') 空的,但仍在那里,以防我真的想用那天的东西填满它 如何在JS文件中实现这一点 if (new Date().getDay() == 0) { /* it's Sunday */ } else { /* it's not Sunday */ } if((new Date()).getDay() >=1) {
document.write('DIVS/HTML go here')
只有在星期天,我希望它是:
document.write(' ')
空的,但仍在那里,以防我真的想用那天的东西填满它
如何在JS文件中实现这一点
if (new Date().getDay() == 0)
{
/* it's Sunday */
}
else
{
/* it's not Sunday */
}
if((new Date()).getDay() >=1)
{
// Monday - Saturday
document.write('DIVS/HTML go here');
}
else
{
// Sunday
document.write(' ');
}