<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
table td a:link,table td a:visited{
text-decoration:none;
color:#0099FF;
}
table,table td{
/*border:#0099CC 1px solid;*/
}
</style>
<script type="text/javascript" src="../Day26/doctool.js"></script>
<script type="text/javascript">
var count = 1;
function addFile()
{
var tabNode = byTag("table")[0];
var trNode = tabNode.insertRow();
trNode.id = "tr_"+count;
var tdNode_file = trNode.insertCell();
var tdNode_del = trNode.insertCell();
tdNode_file.innerHTML = "<input type='file' />";
//tdNode_del.innerHTML = "<a href='javascript:void(0)' οnclick='delfile("+count+")'>删除附件"+count+"</a>";
tdNode_del.innerHTML = "<a href='javascript:void(0)' οnclick='delfile(this)'>删除附件"+count+"</a>";
count++;
}
function delfile(node)
{
var trNode = node.parentNode.parentNode;
trNode.parentNode.removeChild(trNode);
}
/*
function delfile(num)
{
var trNode = byId("tr_"+num);
trNode.parentNode.removeChild(trNode);
//alert(node.nodeName);
//var tabNode = byTag("table")[0];
//var tbdNode = tabNode.childNodes[0];
//tbdNode.removeChild(trNode);
}
*/
</script>
</head>
<body>
<table>
<tr>
<td>
<a href="javascript:void(0)" οnclick="addFile()">添加附件</a>
</td>
</tr>
</table>
</body>
</html>