easyui 框架下 代码如下:
css:
.file_box{ float: right; width: 1035px; border: 1px solid #999; height: 32px; line-height: 35px; padding-left: 10px; margin-right: 25px; } .file{ float: right; outline: none; border:none; background: #67BEF4; border-radius: 4px; padding: 4px 12px; cursor:pointer; color: #fff; font-size:18px; line-height: 20px; vertical-align: middle; margin: 2px; }
html 页面:
<div class="file_box"> <button type="button" class="file" id="select_file" onclick="file1.click();" > 选择附件</button> <input type="file" id="file1" name="PXXA_APPENDIX" style="width:250px;display: none;" onchange="setfile_tmp()";> <input type="text" id="file2" readonly="readonly" th:value="${map.PXXA_APPENDIX}" onclick="file1.click(); "> </div>
js脚本:
function setfile_tmp(){ var file11 = $("#file1")[0].value; var arrays1 = file11.split("\\"); var name1 = arrays1[arrays1.length-1]; name1=name1.toLowerCase(); $("#file2")[0].value=name1; }
总结