<html>
<head>
<{literal}>
<script language="javascript">// Example: obj = findObj("image1");
<!--
function findObj(theObj, theDoc){
var p, i, foundObj;
if(!theDoc) theDoc = document;
if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){
theDoc = parent.frames[theObj.substring(p+1)].document;
theObj = theObj.substring(0,p);
}
if(!(foundObj = theDoc[theObj]) && theDoc.all)
foundObj = theDoc.all[theObj];for (i=0; !foundObj && i < theDoc.forms.length; i++)
foundObj = theDoc.forms[i][theObj];for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
foundObj = findObj(theObj,theDoc.layers[i].document);
if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
return foundObj;
}
//添加一个参与人填写行
function AddSignRow(){//读取最后一行的行号,存放在txtTRLastIndex文本框中
var txtTRLastIndex = findObj("txtTRLastIndex",document);
var rowID = parseInt(txtTRLastIndex.value);
var signFrame = findObj("SignFrame",document);
//添加行
var newTR = signFrame.insertRow(signFrame.rows.length);
newTR.id = "SignItem" + rowID;
//添加列:序号
var newNameTD=newTR.insertCell(0);
//添加列内容
/*newNameTD.innerHTML = newTR.rowIndex.toString();*/
//添加列:附件
var newEmailTD=newTR.insertCell(1);
//添加列内容
newEmailTD.innerHTML = "<input name='filename[]' type='file' size='30' οnchange='javascript:change();' />";
//添加列:附件标注
var newNameTD=newTR.insertCell(2);
//添加列附件标注
newNameTD.innerHTML = "<input name='testother[]' type='text' size='15' />";
//添加列:删除按钮
var newDeleteTD=newTR.insertCell(3);
//添加列内容
newDeleteTD.innerHTML = "<div align='center' style='width:40px'><a href='javascript:;' οnclick=/"DeleteSignRow('SignItem" + rowID + "')/">删除</a></div>";
//添加列:文件后缀
var newTelTD=newTR.insertCell(4);
//添加列文件后缀内容
newTelTD.innerHTML = "<input name='filesuffix[]' type='hidden' />";
//将行号推进下一行
txtTRLastIndex.value = (rowID + 1).toString() ;
}
//删除指定行
function DeleteSignRow(rowid){
var signFrame = findObj("SignFrame",document);
var signItem = findObj(rowid,document);
//获取将要删除的行的Index
var rowIndex = signItem.rowIndex;
//删除指定Index的行
signFrame.deleteRow(rowIndex);
//重新排列序号,如果没有序号,这一步省略
/*for(i=rowIndex;i<signFrame.rows.length;i++){
signFrame.rows[i].cells[0].innerHTML = i.toString();
}*/
}//清空列表
//获取文件域的值
function change(){
var filein = document.getElementsByName("filename[]");
var textin = document.getElementsByName("testother[]");
var textsu = document.getElementsByName("filesuffix[]");
for( var i=0; i<filein.length; i++){
var str1=filein[i].value;
var regstr=;
var regresult=new RegExp(regstr)
var sss=str1.split(regresult,'100');
var need=sss[sss.length-1];
var a=need.split('.');
// textin[i].value = filein[i].value;
textin[i].value = a[0];
textsu[i].value = a[1];
}
}
-->
</script>
<{/literal}>
</head>
<body>
<!-- 新增、修改 任务页面-->
<form method="post" enctype="multipart/form-data" action="" id="addTask" name="addTask">
<table border="1" align="center" cellpadding="0" cellspacing="0" id="SignFrame">
<tr><!-- 命名为action的 隐藏文本框 用于说明即将的操作-->
<td width="89">任务标题</td>
<td colspan="3"><input name="subject" type="text" size="70" /></td>
</tr>
<tr>
<td>创建人</td>
<td width="131"><{$creator}>
<input type="hidden" name="creator" value="<{$creator}>"/>
<td width="90" align="center">所属部门</td>
<td ><{if $depart eq null}>领导层<{else}><{$depart}><{/if}>
<input type="hidden" name="depart" value="<{$depart}>"></td>
</tr>
<tr>
<td valign="top">任务内容</td>
<td colspan="3" valign="top"><textarea name="definition" cols="70" rows="5"></textarea></td>
</tr>
<tr>
<td colspan="4" align="center"><input type="submit" name="Submit" value="保存"></td>
</tr>
<input name='txtTRLastIndex' type='hidden' id='txtTRLastIndex' value="1" />
<tr>
<td align="center">附件内容</td>
<td colspan="3" align="center"><input type="button" name="add" value="添加附件" onClick="AddSignRow()" /> </td>
</tr>
<tr id="trHeader">
<td> </td>
<td>附件标注</td>
<td>附件</td>
<td>删除</td>
</tr>
</table>
</form>
</body>
</html>