动态生成表格行!!求助啊 <%if rs.next()!=fasle%><tr><td><%=rs.getString()%></td></tr> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用Dhtml通过改动innerHTML属性动态增加行数 var e = document.all.product;var tr = e.insertRow(); //增加一行;tr.insertCell(); //行里增加一列tr.insertCell();tr.insertCell(); 同意meizz借用一下fason的收藏http://fason.nease.net/zhuanti/table/sort.htm <HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>现场照片</title><script language="javascript">function CheckData(){ nLimFileSize=parseInt(document.all.FILE_SIZE.value); nLimWidth=parseInt(document.all.PICTURE_WIDTH.value); nLimHeight=parseInt(document.all.PICTURE_HEIGHT.value); for(i=0;i<document.getElementsByName("Name").length;i++) { oName=document.getElementsByName("Name")[i]; oFile=document.getElementsByName("FilePath")[i]; nFileSize=frames["_hideFrame"].document.all.VerifyTable.rows[i].all.tags("img")[0].fileSize; nWidth=frames["_hideFrame"].document.all.VerifyTable.rows[i].all.tags("img")[0].width; nHeight=frames["_hideFrame"].document.all.VerifyTable.rows[i].all.tags("img")[0].height; if(oName.value=="") { oName.focus(); alert("名称不能为空!"); return false; } if(nFileSize==-1) { oFile.focus(); alert("图片为空或类型无效!"); return false; } if(nFileSize>nLimFileSize) { oFile.focus(); alert("图片文件太大,请限制在" + nLimFileSize + "字节以内!"); return false; } if(nWidth>nLimWidth||nHeight>nLimHeight) { oFile.focus(); alert("图片太大,请限制在" + nLimWidth + "X" + nLimHeight + "大小!"); return false; } }}function AddMoreRow(){ oRow=event.srcElement.parentNode.parentNode; oTable=event.srcElement.parentNode.parentNode.parentNode.parentNode; oNewRow=oTable.insertRow(); for(i=0;i<oRow.cells.length;i++) { oNewRow.insertCell().innerHTML=oRow.cells[i].innerHTML; } oRow.all("DelBtn").disabled=false; oNewRow.all("DelBtn").disabled=false; oNewRow.className="content"; frames["_hideFrame"]._AddMoreRow();}function DeleteThisRow(){ oRow=event.srcElement.parentNode.parentNode; oTable=event.srcElement.parentNode.parentNode.parentNode.parentNode; if(oTable.rows.length>1) { frames["_hideFrame"]._DeleteThisRow(oRow.rowIndex); oTable.deleteRow(oRow.rowIndex); if(oTable.rows.length==1) { oTable.all("DelBtn").disabled=true; } }}function DisabledKeyInput(){ if(event.keyCode!=8&&event.keyCode!=46) event.returnValue=false;}function HidePreviewPicture(){ document.all.img.innerHTML="";}function VerifyPicture(){ nLimFileSize=parseInt(document.all.FILE_SIZE.value); nLimWidth=parseInt(document.all.PICTURE_WIDTH.value); nLimHeight=parseInt(document.all.PICTURE_HEIGHT.value); oRow=event.srcElement.parentNode.parentNode; oImg=frames["_hideFrame"].document.all.VerifyTable.rows[oRow.rowIndex].all.tags("img")[0]; oImg.src=event.srcElement.value; document.all.img.innerHTML="<img src='" + event.srcElement.value + "'>" document.all.img.childNodes[0].attachEvent("onerror",HidePreviewPicture) if(oImg.readyState=="complete") { if(oImg.fileSize==-1) { alert("文件类型无效!") } else if(oImg.fileSize>nLimFileSize) { alert("图片文件太大,请限制在" + nLimFileSize + "字节以内!") } else if(oImg.width>nLimWidth||oImg.height>nLimHeight) { alert("图片太大,请限制在" + nLimWidth + "X" + nLimHeight + "大小!") } }}</script></HEAD><body class=scrollbar1 topmargin=10><xml style="display:none" id=PictureSet><ROOT><PICTURE_WIDTH>800</PICTURE_WIDTH><PICTURE_HEIGHT>600</PICTURE_HEIGHT><FILE_SIZE>819200</FILE_SIZE></ROOT></xml><input datasrc="#PictureSet" datafld="PICTURE_WIDTH" id="PICTURE_WIDTH" style="display:none"><input datasrc="#PictureSet" datafld="PICTURE_HEIGHT" id="PICTURE_HEIGHT" style="display:none"><input datasrc="#PictureSet" datafld="FILE_SIZE" id="FILE_SIZE" style="display:none"><form target="_hideFrame" method=post enctype="multipart/form-data" action="BatchAddPicture_DB.asp?kch=<%=kch%>&caseno=<%=caseno%>&lx=<%=lx%>" onsubmit="return CheckData()"><table><th><%=lx%>批量上传</th></table><table> <tr class=content> <td nowrap>名称*</td> <td><input type="text" name="Name" size=15 maxlength="50"></td> <td nowrap>文件路径*</td> <td> <input type=file name="FilePath" size=15 onkeydown="DisabledKeyInput()" onpropertychange="VerifyPicture()"> </td> <td nowrap>说明</td><td><input type=text name=Description size=45><input type="button" class="input1" value="增加" onclick="AddMoreRow()"></td> <td nowrap> <input type="button" class="input1" id=DelBtn value="删除" disabled onclick="DeleteThisRow()"> </td> </tr></table><table> <tr align =center> <td class="tijiao" align =center> <input type="submit" class="input1" value="保存"> <input type="reset" class="input1" value="取消"> </td> </tr></table><iframe src="about:blank" width=100% height=0 name="_hideFrame"></iframe><div id="img"></div><div id=tempHTML style="display:none"><script>function _AddMoreRow(){ oCell=document.all.VerifyTable.insertRow().insertCell(); oImg=document.createElement("img"); oImg.attachEvent("onreadystatechange",_VerifyPicture); oImg.attachEvent("onerror",_PictureError); oCell.appendChild(oImg);}function _DeleteThisRow(rowIndex){ document.all.VerifyTable.deleteRow(rowIndex);}function _PictureError(){ if(event.srcElement.fileSize==-1) { alert("无效的图片类型!"); }}function _VerifyPicture(){ oImg=event.srcElement; if(oImg.readyState=="complete") { nWidth=parseInt(parent.document.all.PICTURE_WIDTH.value); nHeight=parseInt(parent.document.all.PICTURE_HEIGHT.value); nFileSize=parseInt(parent.document.all.FILE_SIZE.value); if(oImg.width>nWidth||oImg.height>nHeight) { alert("图片尺寸太大,请限制在" + nWidth + "X" + nHeight + "大小!") } else if(oImg.fileSize>nFileSize) { alert("图片文件超出限定大小,请限定在" + nHeight + "字节以内!") } }}</script><table border=0 id=VerifyTable> <tr><td><img border=0 onerror="_PictureError()" onreadystatechange="_VerifyPicture()"></td></tr></table></div><script language=javascript>function InitFrame(){ frames["_hideFrame"].document.write(document.all.tempHTML.innerHTML);}window.onload=InitFrame;</script></form></BODY></HTML> eva(eva)兄你给的资源我刚看完.太牛了.分给的不合理,我再开一贴请来领分. js 动态创建多个表单元素,删除创建的表单元素 怎样用js在上传前判断图片的大小和尺寸?要适合IE和FIREFOX浏览器 JS帝何在?水平滚动条控制问题 js或者jquery向静态网页中加入声音文件 怎样在firefox中判断浏览器是关闭还是刷新 FF下DIV的拖拉问题???IE 下是好用的 如何在scrip中解析jsp的数组 在下拉列表框中显示多列 为什么这个错误只在IE5上有错,怎样解决这个问题呢?? 请问,是不是ie6打了补丁,版本就是6.0.2800.1106 window.open("open.htm"," 500分求菜单功能。
通过改动innerHTML属性动态增加行数
tr.insertCell(); //行里增加一列
tr.insertCell();
tr.insertCell();
http://fason.nease.net/zhuanti/table/sort.htm
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>现场照片</title>
<script language="javascript">
function CheckData()
{
nLimFileSize=parseInt(document.all.FILE_SIZE.value);
nLimWidth=parseInt(document.all.PICTURE_WIDTH.value);
nLimHeight=parseInt(document.all.PICTURE_HEIGHT.value);
for(i=0;i<document.getElementsByName("Name").length;i++)
{
oName=document.getElementsByName("Name")[i];
oFile=document.getElementsByName("FilePath")[i];
nFileSize=frames["_hideFrame"].document.all.VerifyTable.rows[i].all.tags("img")[0].fileSize;
nWidth=frames["_hideFrame"].document.all.VerifyTable.rows[i].all.tags("img")[0].width;
nHeight=frames["_hideFrame"].document.all.VerifyTable.rows[i].all.tags("img")[0].height;
if(oName.value=="")
{
oName.focus();
alert("名称不能为空!");
return false;
}
if(nFileSize==-1)
{
oFile.focus();
alert("图片为空或类型无效!");
return false;
}
if(nFileSize>nLimFileSize)
{
oFile.focus();
alert("图片文件太大,请限制在" + nLimFileSize + "字节以内!");
return false;
}
if(nWidth>nLimWidth||nHeight>nLimHeight)
{
oFile.focus();
alert("图片太大,请限制在" + nLimWidth + "X" + nLimHeight + "大小!");
return false;
}
}
}
function AddMoreRow()
{
oRow=event.srcElement.parentNode.parentNode;
oTable=event.srcElement.parentNode.parentNode.parentNode.parentNode;
oNewRow=oTable.insertRow();
for(i=0;i<oRow.cells.length;i++)
{
oNewRow.insertCell().innerHTML=oRow.cells[i].innerHTML;
}
oRow.all("DelBtn").disabled=false;
oNewRow.all("DelBtn").disabled=false;
oNewRow.className="content";
frames["_hideFrame"]._AddMoreRow();
}
function DeleteThisRow()
{
oRow=event.srcElement.parentNode.parentNode;
oTable=event.srcElement.parentNode.parentNode.parentNode.parentNode;
if(oTable.rows.length>1)
{
frames["_hideFrame"]._DeleteThisRow(oRow.rowIndex);
oTable.deleteRow(oRow.rowIndex);
if(oTable.rows.length==1)
{
oTable.all("DelBtn").disabled=true;
}
}
}
function DisabledKeyInput()
{
if(event.keyCode!=8&&event.keyCode!=46) event.returnValue=false;
}
function HidePreviewPicture()
{
document.all.img.innerHTML="";
}
function VerifyPicture()
{
nLimFileSize=parseInt(document.all.FILE_SIZE.value);
nLimWidth=parseInt(document.all.PICTURE_WIDTH.value);
nLimHeight=parseInt(document.all.PICTURE_HEIGHT.value);
oRow=event.srcElement.parentNode.parentNode;
oImg=frames["_hideFrame"].document.all.VerifyTable.rows[oRow.rowIndex].all.tags("img")[0];
oImg.src=event.srcElement.value;
document.all.img.innerHTML="<img src='" + event.srcElement.value + "'>"
document.all.img.childNodes[0].attachEvent("onerror",HidePreviewPicture)
if(oImg.readyState=="complete")
{
if(oImg.fileSize==-1)
{
alert("文件类型无效!")
}
else if(oImg.fileSize>nLimFileSize)
{
alert("图片文件太大,请限制在" + nLimFileSize + "字节以内!")
}
else if(oImg.width>nLimWidth||oImg.height>nLimHeight)
{
alert("图片太大,请限制在" + nLimWidth + "X" + nLimHeight + "大小!")
}
}
}
</script>
</HEAD>
<body class=scrollbar1 topmargin=10>
<xml style="display:none" id=PictureSet>
<ROOT><PICTURE_WIDTH>800</PICTURE_WIDTH><PICTURE_HEIGHT>600</PICTURE_HEIGHT><FILE_SIZE>819200</FILE_SIZE></ROOT>
</xml>
<input datasrc="#PictureSet" datafld="PICTURE_WIDTH" id="PICTURE_WIDTH" style="display:none">
<input datasrc="#PictureSet" datafld="PICTURE_HEIGHT" id="PICTURE_HEIGHT" style="display:none">
<input datasrc="#PictureSet" datafld="FILE_SIZE" id="FILE_SIZE" style="display:none">
<form target="_hideFrame" method=post enctype="multipart/form-data" action="BatchAddPicture_DB.asp?kch=<%=kch%>&caseno=<%=caseno%>&lx=<%=lx%>" onsubmit="return CheckData()">
<table><th><%=lx%>批量上传</th></table>
<table>
<tr class=content>
<td nowrap>名称*</td>
<td><input type="text" name="Name" size=15 maxlength="50"></td>
<td nowrap>文件路径*</td>
<td>
<input type=file name="FilePath" size=15 onkeydown="DisabledKeyInput()" onpropertychange="VerifyPicture()">
</td>
<td nowrap>说明</td><td><input type=text name=Description size=45><input type="button" class="input1" value="增加" onclick="AddMoreRow()"></td>
<td nowrap>
<input type="button" class="input1" id=DelBtn value="删除" disabled onclick="DeleteThisRow()">
</td>
</tr>
</table>
<table>
<tr align =center>
<td class="tijiao" align =center>
<input type="submit" class="input1" value="保存"> <input type="reset" class="input1" value="取消">
</td>
</tr>
</table>
<iframe src="about:blank" width=100% height=0 name="_hideFrame"></iframe>
<div id="img"></div>
<div id=tempHTML style="display:none">
<script>
function _AddMoreRow()
{
oCell=document.all.VerifyTable.insertRow().insertCell();
oImg=document.createElement("img");
oImg.attachEvent("onreadystatechange",_VerifyPicture);
oImg.attachEvent("onerror",_PictureError);
oCell.appendChild(oImg);
}
function _DeleteThisRow(rowIndex)
{
document.all.VerifyTable.deleteRow(rowIndex);
}
function _PictureError()
{
if(event.srcElement.fileSize==-1)
{
alert("无效的图片类型!");
}
}
function _VerifyPicture()
{
oImg=event.srcElement;
if(oImg.readyState=="complete")
{
nWidth=parseInt(parent.document.all.PICTURE_WIDTH.value);
nHeight=parseInt(parent.document.all.PICTURE_HEIGHT.value);
nFileSize=parseInt(parent.document.all.FILE_SIZE.value);
if(oImg.width>nWidth||oImg.height>nHeight)
{
alert("图片尺寸太大,请限制在" + nWidth + "X" + nHeight + "大小!")
}
else if(oImg.fileSize>nFileSize)
{
alert("图片文件超出限定大小,请限定在" + nHeight + "字节以内!")
}
}
}
</script>
<table border=0 id=VerifyTable>
<tr><td><img border=0 onerror="_PictureError()" onreadystatechange="_VerifyPicture()"></td></tr>
</table>
</div>
<script language=javascript>
function InitFrame()
{
frames["_hideFrame"].document.write(document.all.tempHTML.innerHTML);
}
window.onload=InitFrame;
</script>
</form>
</BODY>
</HTML>
分给的不合理,我再开一贴请来领分.