js代码实现填写简历时“添加项目经历”功能

来源:互联网 发布:itunes下载ipad软件 编辑:程序博客网 时间:2024/05/19 21:40
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title> New Document </title>  <meta http-equiv="Content-Type" content="text/html; charset=GBK">  <meta name="Generator" content="EditPlus">  <meta name="Author" content="">  <meta name="Keywords" content="">  <meta name="Description" content="">  <script>var index=0;function addedu(){//alert(index);var edu=document.getElementById("education");var current = document.getElementById("current_edu");current.removeAttribute("id");//var count = current.childNodes.length;index++;var button = document.getElementById("add_but");var new_button = button.cloneNode();//alert(index+":"+count);current.removeChild(button);//var another = first.cloneNode();var another = document.createElement("div");//var child_text1 = document.createTextNode("");var child_time = document.createElement("input");var time_text = document.createTextNode("时间");child_time.setAttribute("type","text");child_time.setAttribute("name","time"+index);var child_name=document.createElement("input");var name_text = document.createTextNode("学校");child_name.setAttribute("type","text");child_name.setAttribute("name","edu"+index);var child_br = document.createElement("br");another.appendChild(time_text);another.appendChild(child_time);another.appendChild(name_text);another.appendChild(child_name);another.appendChild(new_button);another.appendChild(child_br);another.setAttribute("id","current_edu");edu.appendChild(another);}  </script> </head> <body>  <div id="education"><div id="current_edu">时间<input type="text" name="time0"/>学校<input type="text" name="edu0"/><input type="button" value="+" id="add_but" onclick="addedu();"/><br/></div>  </div> </body></html>