ASP:文件上传编辑[否文件选择"信息 [英] Asp:FileUpload edit "No file selected" message

查看:116
本文介绍了ASP:文件上传编辑[否文件选择"信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只需要知道,如果有一种方法为更改消息天冬氨酸图所示:文件上传时被选定任何文件。

I just need to know if there's a way to change the message shown by the Asp:FileUpload when no file as been selected.

感谢。

推荐答案

您用自己的使用消息CSS pseduo级替换的文字:在。你可以声明一个类像这样的:

You replace the text with your own message using CSS pseduo-class :after. You can declare a class like this one:

.bar:after {
    content:"Please select a file";
    background-color:white;
}

并将其分配给您的FileUpload控件。内容消息将代替原来的。当然,在文件选择需要删除的信息,例如,您可以通过jQuery做到这一点 .removeClass (假设你的FileUpload的ID是富):

And assign it to your FileUpload control. The content message will replace the original one. Of course upon file selection you need to remove the message, you can do this for example via jQuery .removeClass (assuming ID of your FileUpload is "foo"):

$('#foo').change(function() {
    $(this).removeClass("bar");
})

演示: http://jsfiddle.net/5zhuL/2/

请注意,此解决方案似乎工作Webkit的浏览器是唯一(铬,歌剧,Safari浏览器),你可能需要别人的替代品。

Note that this solution seems to work Webkit-browser's only (Chrome, Opera, Safari) you may need an alternative for others.

这篇关于ASP:文件上传编辑[否文件选择"信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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