怎么才能让自动添加停止下来?<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>无标题文档</title></head> </head><body><ul id="ultt"> <li >勇士</li> <li >骑士</li> <li id="litt">雷霆</li> <li>火箭</li> </ul> <script> function test (){ var aobj= document.createElement("li"); aobj.innerHTML="快船"; ultt.appendChild(aobj ) } function tian (){ var i =setInterval('test()',1000) } </script><input type="button" value="自动添加" onclick="tian ()" /><input type="button" value="停止添加" onclick="clearInterval(i)" /></body></html>
添加回答
举报
0/150
提交
取消