思路:本题要想实现用javascript做出重置效果需要用到JavaScript实现重置表单(reset)的方法。
例子:
<form id="form1"><input type="text" id="name"/>
<input type="button" value="这个用JavaScript清除" onclick="document.getElementById('form1').reset()"/>
<input type="reset" value="这个是Form清除" />//reset()重置
</form>
你点击添加的时候将数据添加到一个数组比如 添加按钮点击 数组A加一个成员
A.push(txt.value)
当点击清空时
B=A
A=[]
然后清空界面元素
点击重置 A=B
然后根据A数组的值重新创建li元素