<script language=javascript>
var modified = 0;
var currentline = -1;
var line = -1;
var allcount = 4;
function adduploadfile()
{
newrow = tablea.insertrow(tablea.rows.length);
newrow.id = "fileuploadid";
newrow.ln = allcount;
newrow.pn = allcount;
c1 = newrow.insertcell(0);
c1.ln=allcount;
c1.pn=allcount;
c1.innerhtml = "<input type = file size=40 name='filename"+allcount+"' ln="+allcount+" pn="+allcount+">";
c2=newrow.insertcell(1);
c2.ln=allcount;
c2.pn=allcount;
c2.onclick=delit;
c2.align = 'center';
c2.innerhtml="删 除";
c3=newrow.insertcell(2);
c3.ln=allcount;
c3.pn=allcount;
c3.onclick=showpic;
c3.align = 'center';
c3.innerhtml="预 览";
allcount++;
}
function delit()
{
line=parseint(event.srcelement.ln,10)
if (line>0)
for (i=1; i<tablea.rows.length ; i++)
{
if (fileuploadid[i].ln==line )
{
var temp=eval("document.uploadform.filename"+line+".value");
if ( temp.length>0 )
{
if (!confirm("确认删除此附件?")) { return; }
}
tablea.deleterow(i);
}
}
}
function showpic()
{
line=parseint(event.srcelement.ln,10)
if (line>0)
for (i=1; i<tablea.rows.length ; i++)
if (fileuploadid[i].pn==line)
{
var temp=eval("document.uploadform.filename"+line+".value");
if ( temp.length>0 )
{
c4=fileuploadid[i].insertcell();
c4.align = 'center';
c4.innerhtml="<img src='"+temp+"' width='50px' /> ";
fileuploadid[i].pn = '';
}
}
}
</script>
<form name=uploadform method="post" enctype="multipart/form-data">
<table align=center border='1' id='tablea' width='800px' name='tablea'>
<tr id=fileuploadid>
<td width="40%" align=center> 附件列表 </td>
<td width="20%" align=center> </td>
<td width="20%" align=center> </td>
<td width="20%" align=center> </td>
</tr>
</table>
<table align=center border=1 rules=all width="800px" nowrap>
<tr>
<td align=center>
<input type="button" onclick="adduploadfile();" value="添 加">
</td>
</tr>
</table>
</form>
闽公网安备 35060202000074号