<script type="text/javascript">function add(e){var container = document.getElementById('content');var text = document.getElementById(e).innerHTML;var newNode = document.createElement("span");newNode.innerHTML = text;container.appendChild(newNode);var ui =document.getElementById(e);ui.style.visibility="hidden";}</script></head><body><div style="border:1px #66FFFF solid;font-family:'微軟雅黑'"><h3 style="font-family:'微軟雅黑'">我的愛(ài)好</h3><div><p >先從你喜歡的東西開(kāi)始,讓別人了解你。</p><div ><p>通過(guò)單擊以下標(biāo)簽進(jìn)行選擇:<a href="#" title="換一組標(biāo)簽" >換一下</a></p><div id="option"><span id="0_楊瀾" onclick="add(this.id)">楊瀾</span><span id="0_馬艷麗" onclick="add(this.id)">馬艷麗</span></div></div><div id="content" style="width:400px;height:200px;border:2px #99CCFF solid "></div></div></body>點(diǎn)擊標(biāo)簽后,下面的div中增加,如何刪除增加的標(biāo)簽?zāi)???xiě)不了onclick方法,求大神幫忙修改下
假如想利用js動(dòng)態(tài)增加的控件,請(qǐng)問(wèn)該如何添加onclick方法?
qq_花開(kāi)花謝_0
2021-08-12 18:11:57