scroll down the page a bit athttp://www.htmlgoodies.com/primers/jsp/article.php/3593451to see the desired effect, my delete button won't work
<html><head><script type="text/javascript">school = ['bob','todd','n rodd']function func(name){school.push(name)document.getElementById('arr').value=schooldocument.getElementById('add').value=''}function func2(name) {var iwhile(i<school.length) { if(school[i].toLowerCase() == name) { school.splice(i, 1) document.getElementById('arr').value=school break } } }</script></head><body><form><input type="text" size="90" id="arr" onfocus="this.blur()"><br><input type="text" id="add"><input type="button" value="add" onclick="func(document.getElementById('add').value)"> <input type="button" value="del" onclick="func2(document.getElementById('add').value)"></form></body></html>
also i cant get this one to work, i can create elements i just cant delete more than one, if i recreate another element i can delete another one but i can only delete one without having to recreate another, so there is no point unless the person only creates one elementgo here to see the code running, scroll down abit...http://www.htmlgoodies.com/primers/jsp/article.php/3594621<html><head><script type="text/javascript">var a=0function boba(){table=document.getElementById('me2')tr=document.createElement('TR')td=document.createElement('TD')td2=document.createElement('TD')td3=document.createElement('TD')img=document.createElement('IMG')img.setAttribute('src','mygif.gif')img.onclick=function(){removeme(tr)}inp=document.createElement('INPUT')inp2=document.createElement('INPUT') inp.setAttribute('name','name'+a) inp2.setAttribute('name','email'+a)table.appendChild(tr)tr.appendChild(td)tr.appendChild(td2)tr.appendChild(td3)td.appendChild(img)td2.appendChild(inp)td3.appendChild(inp2)a++}function removeme(tr){tr.parentNode.removeChild(tr)}</script></head><body><table> <tbody id="me2"> <tr> <td> DEMo <input type="text"> </td> <td><input type="text"><input type="button" value="create" onclick="boba()"> </td> </tr> </tbody></table></body></html>thanks