Asp:FileUpload edit “No file selected” message

后端 未结 7 1130
半阙折子戏
半阙折子戏 2021-01-01 04:49

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.

7条回答
  •  梦谈多话
    2021-01-01 05:34

    http://jsfiddle.net/ZDgRG/

    See above link. I use css to hide the default text and use a label to show what I want:

    html

    css

    input[type=file]{
        width:90px;
        color:transparent;
    }
    

    javascript

    window.pressed = function(){
        var a = document.getElementById('aa');
        if(a.value == "")
        {
            fileLabel.innerHTML = "Choose file";
        }
        else
        {
            var theSplit = a.value.split('\\');
            fileLabel.innerHTML = theSplit[theSplit.length-1];
        }
     };
    

提交回复
热议问题