您的位置:首页 > 其它

动态添加附件上传按钮

2006-06-11 19:33 417 查看
<table id="tbAccessory" height="0" cellSpacing="0" cellPadding="0" width="663" align="center"
bgColor="#ccccff" border="0">
<tr>
<td>
<p id="MyFile"></p>
</td>
</tr>
</table>

<script>
var iFileCount=0;
function add()
{
iFileCount=iFileCount+1;
var addCell = new Array();

if(iFileCount<4)
{
if(iFileCount==1)
{
document.all.btAccessory.value='继续粘贴附件';
}
if(iFileCount==3)
document.all.btAccessory.value='粘贴附件';
var str = '              <INPUT type="file" size="50" NAME="File">  <input type=button name=del value=删除 onclick=delFile('+iFileCount+')><br>';
addCell[0]=str;
runRowInsert(tbAccessory, addCell);
//document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str);
//document.getElementById('tbAccessory').insertAdjacentHTML("beforeEnd",str);
}

}
function delFile(index)
{
if(iFileCount==1 && index>0)
tbAccessory.deleteRow(1);
else
tbAccessory.deleteRow(index);
iFileCount=iFileCount-1;
//alert(iFileCount.toString());
}
function runRowInsert(TableHandle, GetCells, RowIndex){
var oRow = null;
var oCel = null;

if (typeof(GetCells) != 'object' || GetCells.length == 0){
alert('错误信息:\n* 没有任何数据需添加!');
}else{
if (typeof(RowIndex) != 'number'|| RowIndex < 0){
oRow = TableHandle.insertRow();

}else{
if (RowIndex < TableHandle.length){
oRow = TableHandle.insertRow(RowIndex);
}else{
oRow = TableHandle.insertRow();
}
}
for (var i = 0; i < GetCells.length; i++){
oCel = oRow.insertCell();
oCel.innerHTML = GetCells[i];
}
}
return oRow;

}
</script>

var iFileCount=0;
function add()
{
iFileCount=iFileCount+1;
var addCell = new Array();
if(iFileCount<4)
{
if(iFileCount==1)
{
document.all.btAccessory.value='继续粘贴附件';
}
if(iFileCount==3)
document.all.btAccessory.value='粘贴附件';
var str = '
';
addCell[0]=str;
runRowInsert(tbAccessory, addCell);
//document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str);
//document.getElementById('tbAccessory').insertAdjacentHTML("beforeEnd",str);
}
}
function delFile(index)
{
if(iFileCount==1 && index>0)
tbAccessory.deleteRow(1);
else
tbAccessory.deleteRow(index);
iFileCount=iFileCount-1;
//alert(iFileCount.toString());
}
function runRowInsert(TableHandle, GetCells, RowIndex){
var oRow = null;
var oCel = null;
if (typeof(GetCells) != 'object' || GetCells.length == 0){
alert('错误信息:\n* 没有任何数据需添加!');
}else{
if (typeof(RowIndex) != 'number'|| RowIndex <0){
oRow = TableHandle.insertRow();
}else{
if (RowIndex
var iFileCount=0;
function add()
{
iFileCount=iFileCount+1;
var addCell = new Array();
if(iFileCount<4)
{
if(iFileCount==1)
{
document.all.btAccessory.value='继续粘贴附件';
}
if(iFileCount==3)
document.all.btAccessory.value='粘贴附件';
var str = '
';
addCell[0]=str;
runRowInsert(tbAccessory, addCell);
//document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str);
//document.getElementById('tbAccessory').insertAdjacentHTML("beforeEnd",str);
}
}
function delFile(index)
{
if(iFileCount==1 && index>0)
tbAccessory.deleteRow(1);
else
tbAccessory.deleteRow(index);
iFileCount=iFileCount-1;
//alert(iFileCount.toString());
}
function runRowInsert(TableHandle, GetCells, RowIndex){
var oRow = null;
var oCel = null;
if (typeof(GetCells) != 'object' || GetCells.length == 0){
alert('错误信息:\n* 没有任何数据需添加!');
}else{
if (typeof(RowIndex) != 'number'|| RowIndex <0){
oRow = TableHandle.insertRow();
}else{
if (RowIndex
var iFileCount=0;
function add()
{
iFileCount=iFileCount+1;
var addCell = new Array();
if(iFileCount<4)
{
if(iFileCount==1)
{
document.all.btAccessory.value='继续粘贴附件';
}
if(iFileCount==3)
document.all.btAccessory.value='粘贴附件';
var str = '
';
addCell[0]=str;
runRowInsert(tbAccessory, addCell);
//document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str);
//document.getElementById('tbAccessory').insertAdjacentHTML("beforeEnd",str);
}
}
function delFile(index)
{
if(iFileCount==1 && index>0)
tbAccessory.deleteRow(1);
else
tbAccessory.deleteRow(index);
iFileCount=iFileCount-1;
//alert(iFileCount.toString());
}
function runRowInsert(TableHandle, GetCells, RowIndex){
var oRow = null;
var oCel = null;
if (typeof(GetCells) != 'object' || GetCells.length == 0){
alert('错误信息:\n* 没有任何数据需添加!');
}else{
if (typeof(RowIndex) != 'number'|| RowIndex <0){
oRow = TableHandle.insertRow();
}else{
if (RowIndex
var iFileCount=0;
function add()
{
iFileCount=iFileCount+1;
var addCell = new Array();
if(iFileCount<4)
{
if(iFileCount==1)
{
document.all.btAccessory.value='继续粘贴附件';
}
if(iFileCount==3)
document.all.btAccessory.value='粘贴附件';
var str = '
';
addCell[0]=str;
runRowInsert(tbAccessory, addCell);
//document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str);
//document.getElementById('tbAccessory').insertAdjacentHTML("beforeEnd",str);
}
}
function delFile(index)
{
if(iFileCount==1 && index>0)
tbAccessory.deleteRow(1);
else
tbAccessory.deleteRow(index);
iFileCount=iFileCount-1;
//alert(iFileCount.toString());
}
function runRowInsert(TableHandle, GetCells, RowIndex){
var oRow = null;
var oCel = null;
if (typeof(GetCells) != 'object' || GetCells.length == 0){
alert('错误信息:\n* 没有任何数据需添加!');
}else{
if (typeof(RowIndex) != 'number'|| RowIndex <0){
oRow = TableHandle.insertRow();
}else{
if (RowIndex
var iFileCount=0;
function add()
{
iFileCount=iFileCount+1;
var addCell = new Array();
if(iFileCount<4)
{
if(iFileCount==1)
{
document.all.btAccessory.value='继续粘贴附件';
}
if(iFileCount==3)
document.all.btAccessory.value='粘贴附件';
var str = '
';
addCell[0]=str;
runRowInsert(tbAccessory, addCell);
//document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str);
//document.getElementById('tbAccessory').insertAdjacentHTML("beforeEnd",str);
}
}
function delFile(index)
{
if(iFileCount==1 && index>0)
tbAccessory.deleteRow(1);
else
tbAccessory.deleteRow(index);
iFileCount=iFileCount-1;
//alert(iFileCount.toString());
}
function runRowInsert(TableHandle, GetCells, RowIndex){
var oRow = null;
var oCel = null;
if (typeof(GetCells) != 'object' || GetCells.length == 0){
alert('错误信息:\n* 没有任何数据需添加!');
}else{
if (typeof(RowIndex) != 'number'|| RowIndex <0){
oRow = TableHandle.insertRow();
}else{
if (RowIndex
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: