0

基本上,我有这个:

document.write('DIVS/HTML go here')

仅在周日,我希望它是:

document.write(' ')

空的,但仍然在那里,以防我确实想在那天用一些东西填满它。

我将如何在我的 JS 文件中完成此操作?

4

2 回答 2

0
if (new Date().getDay() == 0)
{
    /* it's Sunday */
}
else
{
    /* it's not Sunday */
}
于 2012-02-18T11:45:24.560 回答
0
if((new Date()).getDay() >=1)
{
    // Monday - Saturday
    document.write('DIVS/HTML go here');
}
else
{
    // Sunday
    document.write(' ');
}
于 2012-02-18T11:46:40.810 回答