簡體   English   中英

更改文件按鈕名稱和描述

[英]Change the file button name and description

我在視圖中使用以下代碼創建文件上傳器功能。 這將創建一個按鈕,單擊該按鈕可打開文件資源管理器。
我需要將按鈕名稱從默認名稱“ 選擇文件”更改為其他名稱,同時也選擇無文件”

    <div class="form-group">
        @Html.LabelFor(model => model.Cert, new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            <input type="file" />
        </div>
    </div>

你可以試試這個

<form method="POST" action="myurl"> <span class="btn btn-success fileinput-button">
        <span>Select file</span>

    <input type="file" name="file">
    </span>
</form>


/*Copied from bootstrap */
 .btn {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: normal;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
}
/*Also */
 .btn-success {
    color: #fff;
    background-color: #5cb85c;
    border-color: #4cae4c;
}
/* This is copied from https://github.com/blueimp/jQuery-File-Upload/blob/master/css/jquery.fileupload.css */
 .fileinput-button {
    position: relative;
    overflow: hidden;
}
/*Also*/
 .fileinput-button input {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    opacity: 0;
    -ms-filter:'alpha(opacity=0)';
    font-size: 200px;
    direction: ltr;
    cursor: pointer;
}

http://jsfiddle.net/X3S4a/上的工作示例

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM