【发布时间】:2012-12-27 08:04:39
【问题描述】:
我对 Web 开发非常陌生,我正在尝试创建一个网页,该网页将在单击按钮时向下延伸。我找到了this link,里面有这段代码:
HTML:
<ul id="myList"><li>Coffee</li><li>Tea</li></ul>
<p id="demo">Click the button to append an item to the list</p>
<button onclick="myFunction()">Try it</button>
JavaScript:
function myFunction()
{
var node=document.createElement("LI");
var textnode=document.createTextNode("Water");
node.appendChild(textnode);
document.getElementById("myList").appendChild(node);
}
这将添加信息。我想这样做,以便它动画化,而不仅仅是出现。我该怎么办?
感谢任何帮助或教程。谢谢!
【问题讨论】:
-
您是在寻找纯 JavaScript 解决方案,还是愿意使用 jQuery?
-
我可以使用 jQuery,但正如我所说,我对它很陌生,你必须帮助将它整合到代码中,哈哈。
标签: javascript html dom web