18-4.html
来自「js 全的样例代码,比较适合大家学习和交流」· HTML 代码 · 共 12 行
HTML
12 行
<!-- This div is the element we are animating --><div id="urgent"><h1>Red Alert!</h1>The Web server is under attack!</div><!-- This is the animation script for the element --><script> var e = document.getElementById("urgent"); // Get the element objectvar colors = ["white", "yellow", "orange", "red"] // Colors to cycle throughvar nextColor = 0; // Position in the cycle// Evaluate the following expression every 500 milliseconds. // This animates the background color of the DIV element.setInterval("e.style.backgroundColor=colors[nextColor++%colors.length];", 500);</script>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?