js添加行,删除行

<pre name="code" class="javascript"><tr>
            <td height="24" class="bline">
                <table width="900" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                    	<td width="12%">
                    		开户流程:
                        </td>
                        <td width='88%'>
                         <input type="button" value="增加流程" id="submitButton_3" οnclick="javascript:addRow();"
                       style="cursor: pointer;"/>
                    		 <input type="button" value="重置流程" id="submitButton_3" οnclick="javascript:resetRow();"
                       style="cursor: pointer;"/>
                            
                        </td>
                    </tr>
                    <tr class="trlist">
                    <td width="12%"></td>
                    <td width="88%"><span class="steplist">步骤1</span>:<input class="descriptionlist" name="processList[0].description"  type="text" value="" style="width:130px"/>
                    <input class="piclist" type="text" id="pic0" name="processList[0].pic" value="" readonly="readonly" size="24"/>
                            <input type="button" value="浏览..." style="width: 70px; cursor: pointer;" />
							<span class="litpic_span" style="width: 70px;">
								<input   type="file"  id="uploadFileNew0" onChange="fileChangeNew('pic0',this,0);" size="1" class="np coolbg litpic filelist" />
							</span>
							<input type="button" value="删除" id="submitButton_3" οnclick="javascript:removeeRow(this);"
                       style="cursor: pointer;"/>
                    </td>
                    </tr>
                    <tr id="spefilelast"></tr>
                    
                </table>
            </td>
        </tr>



	function addRow(){
	var newRow ='<tr class="trlist"><td width="12%"></td><td width="88%"><span class="steplist">步骤1</span>:<input class="descriptionlist" name="processList[0].description"  type="text" value="" style="width:130px" /><input class="piclist" type="text" id="pic0" name="processList[0].pic" value="" readonly="readonly" size="24"/><input type="button" value="浏览..." style="width: 70px; cursor: pointer;" /><span class="litpic_span" style="width: 70px;"><input   type="file"  id="uploadFileNew0" onChange="fileChangeNew(\'pic0\',this,0);" size="1" class="np coolbg litpic filelist" /></span><input type="button" value="删除" id="submitButton_3" οnclick="javascript:removeeRow(this);"</td></tr>';
	$("#spefilelast").before(newRow);
	changeList();
	}
	
	function removeeRow(m_this){
	 _p=$(m_this).parent().parent();
        _p.remove();
        changeList();
	}
	
	function changeList(){
	$(".steplist").each(function(index){$(this).text("步骤"+(index+1))});
	$(".descriptionlist").each(function(index){$(this).attr("name","processList["+index+"].description")});
	$(".piclist").each(function(index){$(this).attr("id","pic"+index);$(this).attr("name","processList["+index+"].pic")});
	$(".filelist").each(function(index){$(this).attr("id","uploadFileNew"+index);$(this).attr("onChange","fileChangeNewsss('pic"+index+"',this,"+index+");")});
	}



                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值