使input type="file" 不可编辑
来源:互联网 发布:淘宝店铺怎么下架宝贝 编辑:程序博客网 时间:2024/05/21 17:47
今天在做项目的时候,遇到上传文本框的问题,
<input type="file" size="100" name="photoupload" />
在firefox中,该控件产生的文本框是默认不可编辑的,但是在IE下,该文本框可编辑,
根据用户需要,此文本框应为不可编辑。
但是直接将其设置为“readonly”或者“disabled”后,对应的浏览按钮也无法使用了。所以此法不通。
在网上搜索了一些资料,主要有以下几种方法:
1.变通处理:
<input type=file id=a1 style="visibility:hidden">
<input id=a2 type=text readonly>
<input type=button value=浏览 onclick="a1.click(); a2.value= a1.value">
2.增加如下属性:
contenteditable="false"
实例代码:
<input type="file" style="width: 446px" id="ptlFile" contenteditable="false"/>
对比一下,第二种简单方便,问题解决。
转自:http://www.blogjava.net/sealyu/archive/2009/03/10/231620.html
- 使input type="file" 不可编辑
- 怎么让input type="file" 不可编辑
- input type="file"
- input type=file
- input type=file hack
- input元素 type=file
- IOS6~<input type="file">
- 定义input type=file
- 模拟input type=file
- DHTML:<input type="file">
- 美化<input type='file'>
- 让<input type="checkbox" 不可更改
- 让INPUT不可编辑
- input不可编辑状态
- input标签不可编辑
- input不可编辑
- input不可编辑方法
- 模拟input type=file使各浏览器显示统一
- C/C++时间函数使用方法总结
- PHP取GB2312编码字符串首字母的方法
- 最小化到托盘
- 智能分析用户输入的邮件地址列表
- [转]flex linechart 修改DataTips样式
- 使input type="file" 不可编辑
- Java&CORBA编程实例2
- BurnInTest在测试中的应用
- 胎死腹中
- Javascript中常用的经典技巧
- 流利面试英语
- StringUtils处理字符串以及空格等
- C#中类型转换
- 什么是OO思想