畫一個方框和一個按鈕
綁定按鈕的點擊事件為觸發(fā)file的點擊事件
把file的onchange事件返回的文件名稱設(shè)置到第一個方框里
以jquery為例
$("#btn").bind("click", function(e){
$("#file").trigger("click");
return false;
});
$("#img-file").bind("change", function(){
//設(shè)置取到的文件名至第一個box
});
file
.i-file{ position:absolute; opacity:0; filter:Alpha(opacity=0); width:100%; height:100%; left:0; top:0;} 加多一句,兼容ie filter:alpha(...)
.messageTxt span.fileInputContainer{background:url(images/這里改成你自己的圖片.jpg) no-repeat 0 8px;position:relative;width:57px;}
.fileInput{height:24px;overflow: hidden;font-size:300px;position:absolute;right:0;top:0;opacity: 0;filter:alpha(opacity=0);cursor:pointer;}
CSS:
.div1
{
border:1px soild gray;
padding:5px 5px 5px 5px;
}
.file
{
border:1px soild gray;
}
多謝各位的幫忙
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com