jquery多文件上传dom构造

[ 1254 查看 / 2 回复 ]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript" src="scripts/jquery-1.4.1.js"></script>
   
    <script type="text/javascript">
        $(function() {
            $("#Button1").click(function() {
                $tr = $("#con tr:has(input[type=file]):last");
                $newTr = $tr.clone();
                $tr.after($newTr)
                ;
            });
            $("#Button2").click(function() {
                $num = $("#con tr:has(input[type=file])").length;
                if ($num < 2) {
                    return;
                }
                $("#con tr:has(input[type=file]):last").remove();
            })
            ;
        })
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <input id="Button1" type="button" value="增加" />
    <input id="Button2" type="button" value="删除" />
    <table class="style1" id="con">
        <tr>
            <td>
                <input id="File1" type="file" /></td>
            <td>
                </td>
        </tr>
        <tr>
            <td>
                </td>
            <td>
                </td>
        </tr>
    </table>
     
    </form>
</body>
</html>
1

评分次数

    TOP

    顺便提一个问题,希望老师能解答下
    比如说我有三个不同类型的上传控件
    需要传到不同的目录下
    asp.net 中通过request.files可以返回一个httpPostedFile的集合
    不知道在.net中有没有通过name属性获取控件值的方法
    呵呵,现在纠结于后台的写法
    如果想要与后台结合的话,貌似还有很多的代码需要处理
    TOP

    Request.Form[""]
    应该就行吧
    string str = Request.Form["txtname"].ToString();
    TOP