1、如何去掉里面的值。之前试着修改value。却没有效果。最后只能“杀之”
(http://www.cnblogs.com/21dacia/archive/2008/10/13/1310308.html)
function refreshUploader(who){
var who2= who.cloneNode(false);
who2.onchange= who.onchange;// events are not cloned
who.parentNode.replaceChild(who2,who);
}
2、如果让input中的值不能编辑。。如果type是text,readonly可搞定,但是这个木有readonly呀,网上查到,原来可以这样。(http://cbsahhs.blog.163.com/blog/static/18241455200972411945138/)
2.1. 替代法
使用隐藏的<input type="file"/>控件,然后用一个只读的文本框和一个按钮来模拟<input type="file"/>的功能。
<input type="file" name="file" onpropertychange="file1.value=this.value" style=display:none/>
<input type="text" name="file1" readonly/>
<input type="button" value="浏览" id="button1" name="button1" onclick="file.click()"/>
2.2. 使用脚本事件限制控件输入
将<input type="file"/>控件的鼠标右键菜单、按键事件限制住,不让用户有机会输入。
<input type="file" onkeydown="return false" onkeyup="return false" oncontextmenu="return false">
2.3. 使用contenteditable属性
使用该属性可以有效地限制用户在<input type="file"/>控件中手动输入内容,而只能通过文件选择对话框选择文件。
<input type="file" id="file1" contenteditable="false" />
分享到:
相关推荐
如何将input type=file显示的浏览变成英文的,简单实用!
input type=file 调取手机照相机和选择照片上传 附件下载demo导入运行即可
HTML input type=file文件选择表单元素.docx
input type=file 显示的浏览 改成英文
C#如何使用input[type=file]进行多个图片上传(XMLHttpRequest与后台交互) 详情可看:https://blog.csdn.net/weixin_44713389/article/details/90746459
注意:input[type=file] 标签中的属性accept=application/msword,application/pdf 在pc上正常,但是在手机ios和android上这个文件格式限制会被忽略,所以需要在js中增加格式的判断,以及对应显示样式的设置.(我也是刚...
解决在webview中input标签type="file"不能使用的问题
android webview input=file 失效解决方案
type=file选择图片后,在页面预览显示出来
怎样让input type=file 只读,并能实现文件上传
利用jquery的工具ajaxfileupload.js配合input[type=file]实现无刷新上传文件,内含教程以及支持文件,希望可以帮助各位,谢谢!
json struts2 ajax文件上传 input type=file,选择相同文件也提交,里面附带类库,可以直接运行。使用工具, myeclipse
通过网络搜索发现是因为 android webview 由于考虑安全原因屏蔽了 input type=”file” 这个功能 。 经过不懈的努力,以及google 翻译的帮助 在 stackoverflow 中找到了解决的方法。 具体可以理解为 重写webview 的...
input type=”file” name=”uploadfile” contentEditable=”false” style=”width:80%”>, 提交表单时需要判断其中至少要有一个input已经选择好文件。 代码如下: <input type=”file” name=”uploadfile...
自己收集的按钮国际化实现,大家自己看看,应该有用的
主要介绍了jQuery实现input[type=file]多图预览上传删除等功能,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
主要介绍了css input[type=file] 样式美化(input上传文件样式 )的相关资料,需要的朋友可以参考下
input type="file">元素,它的默认样式: chrome下: IE下: 不管是上面哪种,样式都比较简单,和很多网页的风格都不太协调。 根据用户的需求,设计风格,改变其显示样式的场合就比较多了。 如果,要像下面一样...
input type=”file”/>)用于在客户端浏览并上传文件,用户选取的路径可以由value属性获取,但value属性是只读的,不能通过 javascript来赋值,这就使得不能通过value=””语句来清空它。很容易理解为什么只读,...
当我们想要用css美化表单的时候,有两个控件就会和前段人员作对,一个是是大名鼎鼎的select,另一个就是我现在要说说的input type=file