如何隐藏链接直到特定日期和时间到达 html

Sco*_*iew 0 javascript time

我需要有一个仅在下周一上午 9 点(甚至当地时间)显示的常规 HTML 链接,在此之前它必须保持隐藏状态。有没有一种简单的 javascript 方法可以做到这一点,或者其他什么?

jag*_*oft 5

如果当前时间在某个日期之后,这将采用 id 的 div#links并附加到它。

if ( new Date() >= new Date("Mon Nov 23 2015 9:00") ) {
    document.getElementById("links").innerHTML+= "<a href='target.html'>Some Link</a>";
}
Run Code Online (Sandbox Code Playgroud)