用ylib_getObj()附加更多文件

oyx2007 2007-07-30 08:11:59
<script language="javascript">

var nextHiddenIndex = 3;
function AddFileInput()
{
ylib_getObj("fileInput" + nextHiddenIndex).style.display=document.all?"block" : "table-row";
nextHiddenIndex++;
if(nextHiddenIndex >= 6) ylib_getObj("attachMoreLink").style.display = "none";
}
</script>

<table style="margin:1em 0 1em 0">
<tr valign="top" id="fileInput0" >
<td><b>文件 1:</b></td>
<td><input type=file name=userFile0 size=20 onKeyPress="KeyPress()" ></td>
</tr>
<tr valign="top" id="fileInput1" >
<td><b>文件 2:</b></td>
<td><input type=file name=userFile1 size=20 onKeyPress="KeyPress()" ></td>
</tr>
<tr valign="top" id="fileInput2" >
<td><b>文件 3:</b></td>
<td><input type=file name=userFile2 size=20 onKeyPress="KeyPress()" ></td>
</tr>
<tr valign="top" id="fileInput5" style="display:none">
<td><b>文件 4:</b></td>
<td><input type=file name=userFile5 size=20 onKeyPress="KeyPress()" ></td>
</tr>
<tr valign="top" id="fileInput6" style="display:none">
<td><b>文件 5:</b></td>
<td><input type=file name=userFile6 size=20 onKeyPress="KeyPress()" ></td>
</tr>
<tr valign="top" id="fileInput7" style="display:none">
<td><b>文件 6:</b></td>
<td><input type=file name=userFile7 size=20 onKeyPress="KeyPress()" ></td>
</tr>
</table>
<p id="attachMoreLink"><a href="javascript:AddFileInput()">附加更多文件</a></p>
请问各位,在上面这段代码中,我点击一下“附加更多文件” 应该会出现一个fileinput
但现在没有反映,不知道哪里有问题
...全文
183 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
huo789 2007-07-30
  • 打赏
  • 举报
回复
如果存在ylib_getObj对象
以下改为:(序号排列错误)

<table style="margin:1em 0 1em 0">
<tr valign="top" id="fileInput0" >
<td><b>文件 1:</b></td>
<td><input type=file name=userFile0 size=20 onKeyPress="KeyPress()" ></td>
</tr>
<tr valign="top" id="fileInput1" >
<td><b>文件 2:</b></td>
<td><input type=file name=userFile1 size=20 onKeyPress="KeyPress()" ></td>
</tr>
<tr valign="top" id="fileInput2" >
<td><b>文件 3:</b></td>
<td><input type=file name=userFile2 size=20 onKeyPress="KeyPress()" ></td>
</tr>
<tr valign="top" id="fileInput3" style="display:none">
<td><b>文件 4:</b></td>
<td><input type=file name=userFile3 size=20 onKeyPress="KeyPress()" ></td>
</tr>
<tr valign="top" id="fileInput4" style="display:none">
<td><b>文件 5:</b></td>
<td><input type=file name=userFile4 size=20 onKeyPress="KeyPress()" ></td>
</tr>
<tr valign="top" id="fileInput5" style="display:none">
<td><b>文件 6:</b></td>
<td><input type=file name=userFile5 size=20 onKeyPress="KeyPress()" ></td>
</tr>
</table>
<p id="attachMoreLink"><a href="javascript:AddFileInput()">附加更多文件</a></p>
rjzou2006 2007-07-30
  • 打赏
  • 举报
回复
确定后,再加入这个方法即可!
rjzou2006 2007-07-30
  • 打赏
  • 举报
回复
ylib_getObj方法从哪里来的?

87,992

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧