首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

js 递加html表单里面行

2013-01-23 
js 递增html表单里面行本帖最后由 dyh2452819449 于 2012-12-28 10:53:26 编辑div classform2h5学

js 递增html表单里面行
本帖最后由 dyh2452819449 于 2012-12-28 10:53:26 编辑    <div class="form2">
                <h5>学员信息</h5>
                <table cellspacing="5" cellpadding="0" border="0" width="100%">
                    <tbody>
                    <tr>
                        <th width="50">姓名</th>
                        <th width="50">性别</th>
                        <th width="80">部门</th>
                        <th width="60">职务</th>
                        <th width="110">公司电话</th>
                        <th width="110">手机</th>
                        <th>电子邮件</th>
                    </tr>
                    
                    <tr>
                        <td>
                        <input id="UserName" name="UserName" type="text" value="" style="width:50px;"   /></td>
                        <td>
                    <select id="Gender" name="Gender"  style="border-width:0; width:50px" tabindex="0"><option value="nan" selected>男</option><option value="nv" >女</option></select  
                        </td>
                        <td>
                        <input id="Department" name="Department" type="text" value=""  style="width:80px;"   /></td>
                        <td>


                        <input id="Poste" name="Poste" type="text" value="" style="width:60px;"  /></td>
                        <td>
                       <input id="telephone" name="telephone" type="text" value="" style="width:110px;"   /> </td>
                        <td><input id="phone" name="phone" type="text" value="" class="is_text"  style="width:110px;" /></td>
                        <td>
                        <input id="Electronicmail" name="Electronicmail" type="text" value="" style="width:100%;"   /></td>
                    </tr>
                    
                    <tr>
                        <td>
                        <input id="UserName1" name="UserName" type="text" value="" style="width:50px;"   /></td>
                        <td>
                    <select id="Gender1" name="Gender"  style="border-width:0; width:50px" tabindex="0"><option value="nan" selected>男</option><option value="nv" >女</option></select  
                        </td>
                        <td>
                        <input id="Department2" name="Department" type="text" value=""  style="width:80px;"   /></td>
                        <td>
                        <input id="Poste3" name="Poste" type="text" value="" style="width:60px;"  /></td>
                        <td>


                       <input id="telephone4" name="telephone" type="text" value="" style="width:110px;"   /> </td>
                        <td><input id="phone5" name="phone" type="text" value="" class="is_text"  style="width:110px;" /></td>
                        <td>
                        <input id="Electronicmail6" name="Electronicmail" type="text" value="" style="width:100%;"   /></td>
                    </tr>
                    
                    <tr>
                        <td>
                        <input id="UserName7" name="UserName" type="text" value="" style="width:50px;"   /></td>
                        <td>
                    <select id="Gender2" name="Gender"  style="border-width:0; width:50px" tabindex="0"><option value="nan" selected>男</option><option value="nv" >女</option></select  
                        </td>
                        <td>
                        <input id="Department8" name="Department" type="text" value=""  style="width:80px;"   /></td>
                        <td>
                        <input id="Poste9" name="Poste" type="text" value="" style="width:60px;"  /></td>
                        <td>
                       <input id="telephone10" name="telephone" type="text" value="" style="width:110px;"   /> </td>
                        <td><input id="phone11" name="phone" type="text" value="" class="is_text"  style="width:110px;" /></td>


                        <td>
                        <input id="Electronicmail12" name="Electronicmail" type="text" value="" style="width:100%;"   /></td>
                    </tr>
                    
                    <tr>
                        <td>
                        <input id="UserName13" name="UserName" type="text" value="" style="width:50px;"   /></td>
                        <td>
                    <select id="Gender3" name="Gender"  style="border-width:0; width:50px" tabindex="0"><option value="nan" selected>男</option><option value="nv" >女</option></select>  
                        </td>
                        <td>
                        <input id="Department14" name="Department" type="text" value=""  style="width:80px;"   /></td>
                        <td>
                        <input id="Poste15" name="Poste" type="text" value="" style="width:60px;"  /></td>
                        <td>
                       <input id="telephone16" name="telephone" type="text" value="" style="width:110px;"   /> </td>
                        <td><input id="phone17" name="phone" type="text" value="" class="is_text"  style="width:110px;" /></td>
                        <td>
                        <input id="Electronicmail18" name="Electronicmail" type="text" value="" style="width:100%;"   /></td>


                    </tr>
                </tbody>
                </table>
  <div class="addstudent" style="text-align:right;"><a href="#">继续添加学员</a></div>
            </div>

我需要的是我点击继续添加学员,下面生成一行添加学员信息行?
求高手帮忙解决


jquery如何动态给指定的table的第一行添加一行tr td_ 

[解决办法]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <HTML>
 <HEAD>
 <TITLE> Test </TITLE>
 <META NAME="Generator" CONTENT="EditPlus">
 <META NAME="Author" CONTENT="">
 <META NAME="Keywords" CONTENT="动态增加行">
 <META NAME="Description" CONTENT="http://qwzsky.cnblogs.com/">
 </HEAD>
 <style type="text/css">
 table{
  border : 1px solid black ;
 }
 td{
  width : 100px ;
  border : 1px solid black ;
 }
 </style>
 
<script language="javascript" type="text/javascript">
 var rowNum = 0;
 function insertRow()
 {
 var table1 = document.getElementById("tbl");
 var tr1 = document.createElement("tr");
 
for (var j=0;j<3; j++)
 {
 var td1 = document.createElement("td");
 var tn = document.createTextNode(rowNum);
 td1.appendChild(tn);
 tr1.appendChild(td1);
 }
 rowNum = rowNum + 1;
 //alert(tr1.childNodes[0].innerText);
 table1.childNodes[0].appendChild(tr1);
 //alert(table1.outerHTML);
 }
 </script>
 
<BODY>
 <input id="Insert" type="button" value="Insert" onclick="insertRow();">
 <table border="1" id="tbl">
    <tr>
       <td>NO</td>
       <td>UserID</td>
       <td>Name</td>
    </tr>
 </table>
 </BODY>
 </HTML>
[解决办法]
<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
  $("p").append(" <b>W3School</b>.");
  });
});
</script>
</head>

<body>
<h2>This is a heading</h2>
<p>This is another paragraph.</p>
<button type="button">请点击这里</button>
</body>

</html>

热点排行
Bad Request.