简体   繁体   English

如何删除文件上传中的消息

[英]How to remove the message in the file upload

I want to add input in html to upload images my problem is that next to the button a message shown and i want to remove it how i could do that? 我想在html中添加输入以上传图像,我的问题是在按钮旁边显示了一条消息,我想删除它我该怎么做? This link show my problem: 该链接显示了我的问题:

<input type='file'></input>

http://jsfiddle.net/c3sda/2/ http://jsfiddle.net/c3sda/2/

I want also to change the written on the button from browse to something else is that possible?? 我还想将按钮上的文字从浏览更改为其他可能吗?

There is no cross-browser way to do this. 没有跨浏览器的方法可以做到这一点。 The "no file selected" text is in the implementation-defined part of the widget, and I don't believe that most browsers offer much in the way of browser-specific customization. 小部件的实现定义部分中包含“未选择文件”文本,我不相信大多数浏览器会提供特定于浏览器的自定义方式。 On the other hand, you could simply use CSS to cover the text with something when the value attribute is empty. 另一方面,当value属性为空时,您可以简单地使用CSS覆盖文本。

However you can check the demo link given below. 但是,您可以检查下面给出的演示链接。 It might help you. 它可能会帮助您。

Big button (not hidden so you can see what's going on)
<div class="inputWrapper" style="height: 48px; width: 128px;">
    <input class="fileInput" type="file" name="file1"/>
</div><br/>

Big button (file input is hidden)
<div class="inputWrapper" style="height: 56px; width: 128px;">
    <input class="fileInput hidden" type="file" name="file2"/>
</div><br/>

Medium button (this one has text)
<div class="inputWrapper" style="height: 48px; width: 96px;">
    Upload File
    <input class="fileInput hidden" type="file" name="file3"/>
</div><br/>

Smaller button
<div class="inputWrapper" style="height: 24px; width: 24px;">
    <input class="fileInput hidden" type="file" name="file4"/>
</div>

The Javascript: Javascript:

/ You can use some jQuery to simulate a button-press effect by changing the background color/image, font size/weight/color, etc.. / / 您可以使用一些jQuery通过更改背景颜色/图像,字体大小/粗细/颜色等来模拟按钮按下效果。

$(function() {
    $(".inputWrapper").mousedown(function() {
        var button = $(this);
        button.addClass('clicked');
        setTimeout(function(){
            button.removeClass('clicked');
        },50);
    });
});

The Css: CSS:

.inputWrapper {
    overflow: hidden;
    position: relative;
    cursor: pointer;
    /*Using a background color, but you can use a background image to represent a button*/
    background-color: #DDF;
}

.fileInput {
    cursor: pointer;
    height: 100%;
    position:absolute;
    top: 0;
    right: 0;
    /*This makes the button huge so that it can be clicked on*/
    font-size:50px;
}
.hidden {
    /*Opacity settings for all browsers*/
    opacity: 0;
    -moz-opacity: 0;
    filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0)
}


/*Dynamic styles*/
.inputWrapper:hover {
    background-color: #FDD;
}
.inputWrapper.clicked {
    background-color: #A66;
}


body {
    font-family:Helvetica;
}

Or else Jus Check the Demo.. 否则,请检查演示。

Demo 演示版

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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