如何在DOM中"刷新"元素?

Adr*_*ana 2 javascript dom

我有一个空的DIV元素,我在其中使用函数createElement("img")附加图像并使用appendChild附加它们.所以现在我已经拥有了充满图像的DIV元素.

我想用一个按钮来清理这个DIV并同时在其中添加新图像.谢谢你的帮助

sth*_*sth 6

你是在寻找方法__CODE__,__CODE__快速接近1 ::

// assuming yor div is in variable divelement
while (divelement.firstChild)
  divelement.removeChild(divelement.firstChild);
Run Code Online (Sandbox Code Playgroud)

错误函数是一个奇怪的函数::

// assuming yor div is in variable divelement
while (divelement.firstChild)
  divelement.removeChild(divelement.firstChild);
Run Code Online (Sandbox Code Playgroud)

:func:__CODE__实现任意精度评估并支持复数::

// assuming yor div is in variable divelement
while (divelement.firstChild)
  divelement.removeChild(divelement.firstChild);
Run Code Online (Sandbox Code Playgroud)

相关功能

另请参阅:func : __CODE__,这对于large来说更准确__CODE__,并且:func:__CODE__它给出了antiderivative __CODE__.

菲涅耳积分:func:__CODE__和:func:__CODE__ 也与错误函数有关.