Html input[type=file]在chrome浏览器和safari浏览器 与 IE firefox差别修改
来源:互联网 发布:java jvm原理 编辑:程序博客网 时间:2024/06/11 18:51
var W3CDOM = (document.createElement && document.getElementsByTagName);function initFileUploads() {if (!W3CDOM) return;var fakeFileUpload = document.createElement('div');fakeFileUpload.className = 'fakefile';fakeFileUpload.appendChild(document.createElement('input'));var image = document.createElement('img');image.src='pix/button_select.gif';fakeFileUpload.appendChild(image);var x = document.getElementsByTagName('input');for (var i=0;i<x.length;i++) {if (x[i].type != 'file') continue;if (x[i].parentNode.className != 'fileinputs') continue;x[i].className = 'file hidden';var clone = fakeFileUpload.cloneNode(true);x[i].parentNode.appendChild(clone);x[i].relatedElement = clone.getElementsByTagName('input')[0];x[i].onchange = x[i].onmouseout = function () {this.relatedElement.value = this.value;}}}
在没有修改前如图:
修改浏览器默认input标签js 与css样式
div.fileinputs {position: relative;}div.fakefile {position: absolute;top: 0px;left: 0px;z-index: 1;}input.file {position: relative;text-align: right;-moz-opacity:0 ;filter:alpha(opacity: 0);opacity: 0;z-index: 2;}<div class="fileinputs"><input type="file" class="file" /><div class="fakefile"><input /><img src="search.gif" /></div></div>在一个老外的网站上面看的 顺便整理了下
- Html input[type=file]在chrome浏览器和safari浏览器 与 IE firefox差别修改
- 在IE,Firefox,Safari,Chrome,Opera浏览器上调试javascript
- <input type="file">accept属性 调起手机摄像头 支持Safari Chrome和大部分手机内置浏览器
- Firefox、IE、Safari、Chrome、Opera浏览器之差异
- 106 浏览器判断 IE firefox chrome safari opara
- 五大浏览器js 判断IE、Firefox、Safari、Chrome、Opera
- Safari(苹果)浏览器和IE浏览器修改UserAgent方法
- Html Input File Preview 选择后立即预览 兼容IE,Firefox,Chorom等主流浏览器
- textarea 在 Chrome Safari FireFox 浏览器中禁用拖动和固定大小
- textarea 在 Chrome Safari FireFox 浏览器中禁用拖动和固定大小
- File input 的样式和文字的更改方法__适用于Firefox、IE等浏览器
- File input 的样式和文字的更改方法__适用于Firefox、IE等浏览器
- 各种浏览器(IE,Firefox,Chrome,Opera)COOKIE修改方法[转]
- (轉)js判断浏览器(支持区分ie、firefox、opera、chrome、safari)
- jQuery一步一步实现跨浏览器的可编辑表格,支持IE、Firefox、Safari、Chrome、Opera
- 解决IE,Firefox,chrome,safari浏览器中iframe显示高度自适应问题
- 各浏览器对小数处理取整的情况对比【IE、chrome、firefox、safari】
- ie,firefox,opera,chrome,safari js 判断五大主流浏览器
- 谷歌marker使用说明
- 在视图中使用递归生成树状结构
- Android 资料搜集
- windows 7 下 TortoiseSVN TortoiseCVS 图标无法正常显示
- hdu_2013_蟠桃记
- Html input[type=file]在chrome浏览器和safari浏览器 与 IE firefox差别修改
- 在vista下把telnet开启
- [续]java爬虫程序的exception-2
- hdu_2014_评委会打分
- 找回Firefox“保存并退出”的功能
- 为什么需要htons(), ntohl(), ntohs(),htons() 函数 .模拟htonl、ntohl、htons、ntohs函数实现
- Dev C++ 开源免费集成开发环境
- linux的运行级别 /etc/inittab
- sql中一些常用的函数