蓝叶分享美化file上传表单选择文件按钮代码
- 适用版本 : EMLOG5.3.X
- 模版类别 : html模版
- 适用站点 : 文件上传表单样式
- 模版性质 : 免费模版
- 版权所属 : 蓝叶
- 模版预览 : 看图预览或联系作者
- 模版价格 : ¥0元
模板制作时写file上传文件表单,默认样式不是很好看,为了美观好看就要自定义代码来美化file上传表单选择文件按钮,为了方便有需要的站长,今天蓝叶分享美化file上传表单选择文件按钮代码,代码中包含css样式、html代码、javascript代码,只需要复制代码稍作修改放到模板中就可使用。
<style> *{margin:0;border:0;padding:0;} .file{margin:100px auto 0;width:300px;border:1px solid #00aff0;height:40px;border-radius:6px;position:relative} .blueButton{position:absolute;display:block;width:100px;height:40px;right:0;background-color:#00b3ee;color:#fff;text-decoration:none;text-align:center;font:normal normal normal 16px/40px 'Microsoft YaHei';cursor:pointer;border-radius:4px} .blueButton:hover{text-decoration:none} .myFileUpload{position:absolute;display:block;width:100px;height:40px;right:0;opacity:0} .show{position:absolute;top:5px;left:5px;width:calc(100% - 100px);height:30px;font:normal normal normal 14px/30px 'Microsoft YaHei'} </style> <div class="file"> <div class="show">请选择需要上传的文件...</div> <a href='javascript:void(0);' class="blueButton">选择文件</a> <input type="file" class="myFileUpload" /> </div> <script src="//cdn.staticfile.org/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $(".myFileUpload").change(function(){ var arrs=$(this).val().split('\\'); console.log(arrs); var filename=arrs[arrs.length-1]; $(".show").html(filename); }); }); </script>
评论一下
分享本文
- 版权申明:此文如未标注转载均为本站原创,自由转载请表明出处《蓝叶博客》。
- 本文网址:https://lanyes.org/wangzhanmuban/950.html
- 上篇文章:赚京豆必玩的游戏附挂机代码
- 下篇文章:zblog程序获取当前分类的主分类url地址