标签:
<ul id="a"> <li>aaaaaaaaa</li> <li>bbbbbbbbb</li> <li>ccccccccc</li> </ul> <br/> <input type="button" value="增加10节点" onclick="c()"/> <br/><br/><br/><br/> <!--第二题--> <div class="left"> <select id="lstLeft" size="8"></select> </div> <div class="middle"> <input type="button" id="add" value=">"/> <input type="button" id="addAll" value=">>"/> <input type="button" id="remove" value="<"/> <input type="button" id="removeAll" value="<<"/> </div> <div class="right"> <select id="lstRight" size="8"></select> </div> <br/> <form action="#" method="post" id="frmTest" style="clear: both"> <select id="lstNews" size="8" multiple="multiple" style="display: block"> <option value="1">aaaaa</option> <option value="2">bbbbb</option> <option value="3">ccccc</option> <option value="4">ddddd</option> <option value="5">eeeee</option> </select> <input type="button" id="btnUp" value="向上"/> <input type="button" id="btnDown" value="向下"/> <input type="button" id="btnDelete" value="删除"/> </form> </body> <script type="text/javascript"> var str=[]; var a=document.getElementById("a");
function c(){ for(var i=1;i<=10;i++){ var b=document.createElement("li"); var b1=document.createTextNode(i+"增加标签"); str[i-1]=b.appendChild(b1); // a.appendChild(str[i-1]); } for(var w=0;w<str.length;w++){ var c=document.createElement("div"); var c1=document.createTextNode(str[w]); c.appendChild(c1); a.appendChild(c) }
}
标签:
原文地址:http://www.cnblogs.com/dugufeiyang/p/5518658.html