<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+");")});
}
js添加行,删除行
最新推荐文章于 2024-08-08 16:36:35 发布