简体   繁体   中英

Why is my asp fileupload control textbox clickable?

我有一个asp文件上传控件,该控件在IE8上可以正常运行,但现在它使文本框也可单击,并且功能与浏览按钮相同。

<asp:FileUpload runat="server" ID="id" CssClass="" onchange=""/>

FileUpload controls translates into HTML's input with type="file" control, and what you are experiencing is the default behaviour.

See: input type=file - W3.org

If for some reason you want to disable it then you can do:

    $(document).ready(function () {
        $("#<%= id.ClientID %>").click(function (e) {
        e.preventDefault();
    });
});

(the above code taken/modified from this answer )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM