<!doctype html>window.onload=function (){ varOtext = document.getElementById (' Text1 ')); varOBTN1 = document.getelementsbytagname (' input ') [1]; varOBTN2 = document.getelementsbytagname (' input ') [2]; varOul = document.getElementById (' ul1 ')); varFlag = 1; Obtn1.onclick=function () { if(!otext.value) {return ; } varOli = document.createelement (' li '); Oli.innerhtml=Otext.value; if(oul.children[0]) {Oul.insertbefore (oli,oul.children[0]); } Else{oul.appendchild (oli); } otext.value= ' '; for(vari = 0; i < oul.children.length; i++) {Oul.children[i].onclick=function () { if(flag) { This. Mark = ' 1 '; This. Style.background = ' Yellow '; } Else { This. Mark = "; This. Style.background = "; } Flag= !Flag; } } }; Obtn2.onclick=function () { for(vari = 0; i < oul.children.length; i++) { if(Oul.children[i].mark) {oul.removechild (oul.children[i]); I--; } } }};</script>Dom Message Enhancement