如何向此添加删除。 [英] How to add remove to this.

查看:64
本文介绍了如何向此添加删除。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有人,


我正在尝试做的是创建一个多文件上传。我有它上传多个文件就好了。但是,现在我正在尝试为我上传的每个文件添加删除链接。


基本上它是如何工作的是他们选择上传的文件然后当他们点击提交时上传文件。现在为他们选择上传的每个文件,我希望它旁边有一个删除按钮,这样如果他们改变,那么他们就不必处​​理必须自己清除字段的问题(这需要是在点击提交之前完成)。我遇到的问题是删除部分。


示例让我说我决定上传3个文件,我决定我不需要第二个文件。我遇到的问题是,当我将其上传到我的数据库时,它仍然看到第二个文件,这给了我一个错误。它会说第二个文件中没有任何内容实际上我删除了第二个文件。但我想知道我怎么能做到这一点。如果我有3个文件f1,f2,f3我怎么能代替它说f1,f3(如果我删除第二个文件,它看起来像这样)我怎么能说它f1,f2。


i知道我的解释有点令人困惑。我一直在论坛的coldfusion部分发布这个问题。但现在我的问题变成了一个javascript问题,然后是一个冷血问题。但是这里有一个表格部分的链接,可以解释我想要做的更好一点。
http://bytes.com/forum/showthread.ph...88#post3309788


但这里是代码我得到


javascript

展开 | 选择 | Wrap | 行号

解决方案

而非传递完整的ID,传入上传号码以在循环中使用以更改所有输入字段名称。您始终可以添加f。在删除函数中获取id。


您是否设法使用循环代码?


Acoder,


我在循环中查找了一些信息,现在我对使用哪个循环感到困惑。我正在考虑使用while循环,但不是100%肯定是正确的。这是我在while循环中找到的链接 http://www.w3schools.com /JS/js_loop_while.asp


另一部分我完全感到困惑。你是说要一起把id拿出来吗?因为其他方面我只是困惑。


提前谢谢,

Rach


for循环很好,不需要while循环,虽然如果你愿意也可以使用它。


至于ID传递,我的意思是这样的:

展开 | 选择 | Wrap | 行号

Hey Everyone,

Well what i am trying to do is create a multiple file upload. I have it uploading multiple files just fine. However, now i am trying to add a remove link to each file i upload.

Basically how it works is they choose files to upload an then when they click submit it uploads the files. An now for every file they choose to upload i want it to have a remove button next to it so that if they change there mind they won''t have to deal with the problem of having to clear the field themselves (this needs to be done before they click submit). The problem i am having is with the remove part.

Example lets say i decide to upload 3 files an i decide i don''t need the second file. The problem i am having is when i go to upload it to my database it still sees the 2nd file there an gives me an error. it will say that there is nothing in the 2nd file when in fact i deleted the 2nd file. But i am wondering how can i make it do this. if i have 3 files f1,f2, f3 how can i instead of it saying f1,f3 (it appears like this if i delete the 2nd file) how can i make it say f1,f2.

i know my explanation is a bit confusing. I have been posting this question in coldfusion part of the forum. but now my question has become more a javascript question then a coldfusion question. But here is a link to that part of the form which might explain what i am trying to do a bit better.
http://bytes.com/forum/showthread.ph...88#post3309788

But here is the code i got

javascript

Expand|Select|Wrap|Line Numbers

解决方案

Rather than passing the full ID, pass in the upload number to use in a loop to change all the input field names. You can always add the "f" to get the id in the remove function.

Did you manage to get anywhere with the loop code?


Acoder,

Well i looked up some information on the loop an now i am just baffled on which loop to use. I was thinking of using the while loop, but not 100% sure that would be right. Here is the link i found on while loop http://www.w3schools.com/JS/js_loop_while.asp

an the other part i am baffled on completely.are you saying to take id out of it all together? because other wise i am just confused.

Thank you in advance,
Rach


A for loop is fine, no need for a while loop, though you could use that too if you want.

As for the ID passing, I meant something like this:

Expand|Select|Wrap|Line Numbers


这篇关于如何向此添加删除。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆