如何用JS做动态生成多个上传文件框(详情请看内容)---急100分求解,有效就送分 http://lucky.myrice.com/javascriptexam/index.html看 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 give me your emaili send it to u To: alexander_lin(求知无限) [email protected] http://www.lostinet.com/public/lostinet_Upload/e.g.jscript.form.asphttp://www.lostinet.com/public/ 你试试看这个<HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title></title><script language="JavaScript"> function addFile(){ oRow=document.all.tableID.insertRow(); oCell=oRow.insertCell(); oCell.innerHTML="<input type='file' name='txtimage' size='50' value=''>"; }</script></HEAD><BODY style="border:0" bgcolor="D4d0c8"><div style="padding:3 3"><input type="button" name="Button" value=" 添 加 " class="p9" onclick="addFile()"> <input type="button" name="Button" value=" 粘 贴 " onclick="document.all.frm1.submit()"></div><fieldset><div style="height:expression(document.body.offsetHeight-80);overflow:auto;"><table cellpadding="0" cellspacing="0" border="0" width="471" id="tableID" bordercolordark="#FFFFFF" bordercolorlight="CCCCCC" frame=void><form action=SysUpload_Select.asp method=post name="frm1" target="_self"> <tr> <td> <input type="file" name="txtimage" size="50" value=''> </td> </tr></form></table></div></fieldset></BODY></HTML> 我这里有动态上传文件的代码和我联系..[email protected] <HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=GB2312"><link rel="stylesheet" href="../css/pagestyle.css" type="text/css"><TITLE></TITLE></HEAD><BODY><br><br><form name="form1" method="post" action="" enctype="multipart/form-data"><input type="hidden" name="AttachmentFiles" value="1"><input type="hidden" name="Test" value="@@@@@@@@"><input type="hidden" name="FileUploadStart"> <table width="100%" border="1" cellspacing="1" cellpadding="1" id="FileTable"> <tr bgcolor="#eeeeee"> <td width="21%" height="25"><b>Attachment </b></td> <td width="79%" height="25"><b>Res</b></td> </tr> <tr> <td width="21%" align="right"> <input type="file" name="file_1" size="50" class="input_darkred" style="width:350;cursor:hand"> </td> <td width="79%"> <textarea name="Res_1" cols="50" class="input" rows="3"></textarea> </td> </tr> <tr align="center"> <td colspan="2" height="50"> <input type="button" name="Add" value="Add More" class="btn_DarkRed" style="width:120;cursor:hand" onclick="javascript:AddMoreAttachment()"> <input type="button" name="Upload" value="Upload" class="btn_DarkRed" style="width:60;cursor:hand" onclick="javascript:GoUpload()"> </td> </tr> </table></form></BODY></HTML><script language=javascript src="../Functions/functions.js"></script><script language=vbscript src="../Functions/functions.vbs"></script><script language="javascript"><!--function AddTableRows(TableName,Rows,CellNumber,ArrRowsHTML,ArrAlign,ArrColspan,FileNumber,oTmpFileNumber){ var oTable=eval(TableName); // From row(s) to start insert.. var FromRow=oTable.rows.length-parseInt(Rows); var oFromRow=oTable.insertRow(FromRow); // retrieve the rows collection for the table. var oRows=oTable.rows; // retrieve the cells collection for the first row. var oCells=oFromRow.cells; try{ for(I=1;I<=CellNumber;I++){ var oCell=oRows(oFromRow.rowIndex).insertCell(oCells.length); oCell.height="25"; oCell.align=ArrAlign[I-1]; oCell.colSpan=ArrColspan[I-1]; oCell.innerHTML=ArrRowsHTML[I-1]; } } catch(e) { alert(e.description); oTable.deleteRow(oTable.rows.length-parseInt(Rows)-1) return false; } oTmpFileNumber.value=FileNumber+1;}function AddMoreAttachment(){ var AttachmentFiles=parseInt(document.form1.AttachmentFiles.value); var TmpValue=AttachmentFiles+1 var oTmpFileNumber=document.form1.AttachmentFiles; var CellNumber=2; var ArrRowsHTML = new Array(); var ArrAlign = new Array(); var ArrColspan = new Array(); ArrRowsHTML[0]="<input type=\"file\" name=\"file_" +TmpValue +"\" size=\"50\" class=\"input_darkred\" style=\"width:350;cursor:hand\">"; ArrRowsHTML[1]="<textarea name=\"Res_" + TmpValue +"\" cols=\"50\" class=\"input\" rows=\"3\"></textarea>"; ArrAlign[0]="left"; ArrAlign[1]="left"; ArrColspan[0]=1; ArrColspan[1]=1; AddTableRows("FileTable",1,2,ArrRowsHTML,ArrAlign,ArrColspan,AttachmentFiles,oTmpFileNumber);}function CheckData(){ var AttachmentFiles=parseInt(document.form1.AttachmentFiles.value); for(I=1;I<=AttachmentFiles;I++){ var tmpFile=eval("document.form1.file_"+I); if(typeof(tmpFile)=="object"){ var tmpFileName=tmpFile.value.Trim(); if(tmpFileName==""){ alert("Please select attachment for upload."); return false; } break; } } return true;}function GoUpload(){ if(CheckData()&&(confirm("Confirm to upload?"))){ document.form1.action="Upload.asp" document.form1.submit(); } }//--></script> 接着问一下,能不能在所加的FILE后面加一个删除,点删除、就删除当行的那个<input type='file'>呢 to kaney00(kaney00)当然可以..elementname.removeNode..或者针对表格行用deleteRow 我 用 的deleteRow()总是删除第一个,这么才能删除我 所制定的那个file ext-all.js问题 Extjs 日历控件问题 请问现在JS还能操作注册表吗? 在线急等!回车自动增加一个输入框并且鼠标移到当前输入框! 关于googlemap应用的简单问题 动态生成div将div设置为inline怎么没有效果? 后台如何接受客户端自动生成的Text??? 图片作为背景使用,上面有文字是链接到别的页面上。点击后有个图片与它交换。点击哪个哪个图片变换,同时其他的又变回原来的图片。其实就 如何获得当前点击的是表格的第几行 访问iframe中的iframe中的对象 向高手请教鼠标的问题 如何使用正则表达式分析SQL语句?
i send it to u
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<script language="JavaScript">
function addFile()
{
oRow=document.all.tableID.insertRow();
oCell=oRow.insertCell();
oCell.innerHTML="<input type='file' name='txtimage' size='50' value=''>";
}
</script>
</HEAD>
<BODY style="border:0" bgcolor="D4d0c8">
<div style="padding:3 3"><input type="button" name="Button" value=" 添 加 " class="p9" onclick="addFile()"> <input type="button" name="Button" value=" 粘 贴 " onclick="document.all.frm1.submit()"></div>
<fieldset>
<div style="height:expression(document.body.offsetHeight-80);overflow:auto;">
<table cellpadding="0" cellspacing="0" border="0" width="471" id="tableID" bordercolordark="#FFFFFF" bordercolorlight="CCCCCC" frame=void>
<form action=SysUpload_Select.asp method=post name="frm1" target="_self">
<tr>
<td>
<input type="file" name="txtimage" size="50" value=''>
</td>
</tr></form>
</table>
</div>
</fieldset>
</BODY>
</HTML>
[email protected]
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<link rel="stylesheet" href="../css/pagestyle.css" type="text/css">
<TITLE></TITLE>
</HEAD>
<BODY>
<br>
<br>
<form name="form1" method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="AttachmentFiles" value="1">
<input type="hidden" name="Test" value="@@@@@@@@">
<input type="hidden" name="FileUploadStart">
<table width="100%" border="1" cellspacing="1" cellpadding="1" id="FileTable">
<tr bgcolor="#eeeeee">
<td width="21%" height="25"><b>Attachment </b></td>
<td width="79%" height="25"><b>Res</b></td>
</tr>
<tr>
<td width="21%" align="right">
<input type="file" name="file_1" size="50" class="input_darkred" style="width:350;cursor:hand">
</td>
<td width="79%">
<textarea name="Res_1" cols="50" class="input" rows="3"></textarea>
</td>
</tr>
<tr align="center">
<td colspan="2" height="50">
<input type="button" name="Add" value="Add More" class="btn_DarkRed" style="width:120;cursor:hand" onclick="javascript:AddMoreAttachment()">
<input type="button" name="Upload" value="Upload" class="btn_DarkRed" style="width:60;cursor:hand" onclick="javascript:GoUpload()">
</td>
</tr>
</table>
</form>
</BODY>
</HTML>
<script language=javascript src="../Functions/functions.js"></script>
<script language=vbscript src="../Functions/functions.vbs"></script>
<script language="javascript">
<!--
function AddTableRows(TableName,Rows,CellNumber,ArrRowsHTML,ArrAlign,ArrColspan,FileNumber,oTmpFileNumber){
var oTable=eval(TableName);
// From row(s) to start insert..
var FromRow=oTable.rows.length-parseInt(Rows);
var oFromRow=oTable.insertRow(FromRow);
// retrieve the rows collection for the table.
var oRows=oTable.rows;
// retrieve the cells collection for the first row.
var oCells=oFromRow.cells;
try{
for(I=1;I<=CellNumber;I++){
var oCell=oRows(oFromRow.rowIndex).insertCell(oCells.length);
oCell.height="25";
oCell.align=ArrAlign[I-1];
oCell.colSpan=ArrColspan[I-1];
oCell.innerHTML=ArrRowsHTML[I-1];
}
}
catch(e)
{
alert(e.description);
oTable.deleteRow(oTable.rows.length-parseInt(Rows)-1)
return false;
}
oTmpFileNumber.value=FileNumber+1;
}
function AddMoreAttachment(){
var AttachmentFiles=parseInt(document.form1.AttachmentFiles.value);
var TmpValue=AttachmentFiles+1
var oTmpFileNumber=document.form1.AttachmentFiles;
var CellNumber=2;
var ArrRowsHTML = new Array();
var ArrAlign = new Array();
var ArrColspan = new Array();
ArrRowsHTML[0]="<input type=\"file\" name=\"file_" +TmpValue +"\" size=\"50\" class=\"input_darkred\" style=\"width:350;cursor:hand\">";
ArrRowsHTML[1]="<textarea name=\"Res_" + TmpValue +"\" cols=\"50\" class=\"input\" rows=\"3\"></textarea>";
ArrAlign[0]="left";
ArrAlign[1]="left";
ArrColspan[0]=1;
ArrColspan[1]=1;
AddTableRows("FileTable",1,2,ArrRowsHTML,ArrAlign,ArrColspan,AttachmentFiles,oTmpFileNumber);
}
function CheckData(){
var AttachmentFiles=parseInt(document.form1.AttachmentFiles.value);
for(I=1;I<=AttachmentFiles;I++){
var tmpFile=eval("document.form1.file_"+I);
if(typeof(tmpFile)=="object"){
var tmpFileName=tmpFile.value.Trim();
if(tmpFileName==""){
alert("Please select attachment for upload.");
return false;
}
break;
}
}
return true;
}
function GoUpload(){
if(CheckData()&&(confirm("Confirm to upload?"))){
document.form1.action="Upload.asp"
document.form1.submit();
}
}
//-->
</script>
当然可以..
elementname.removeNode..
或者针对表格行用
deleteRow