javascript 设置input框只读属性 获取disabled后的值并传给后台
来源:互联网 发布:跨平台数据库开发工具 编辑:程序博客网 时间:2024/05/21 09:47
document.getElementById("input").readOnly=true; //O应大写
input只读属性
有两种方式可以实现input的只读效果:disabled 和 readonly。
自然两种出来的效果都是只能读取不能编辑,可是两者有很大不同。
Disabled说明该input无效,及其value不会传递给任何程序,比如asp、php等。
Readonly仅仅是无法编辑,不影响其值的传递。
Readonly仅仅是无法编辑,不影响其值的传递。
Disabled使用:<INPUT type=”text” name=”username” value=”james”disabled>
Readonly使用:<INPUT type=”text” name=”partNumber” value=”1500″ readonly>
Readonly使用:<INPUT type=”text” name=”partNumber” value=”1500″ readonly>
disabled方式若要传值,可以添加隐藏的input标签 <input name="hiddenplanyear" id="hiddenplanyear" type="hidden" class="textfield" value="" />
js中:document.getElementById('hiddenplanyear').value = document.getElementById('planyear').value;
1 0
- javascript 设置input框只读属性 获取disabled后的值并传给后台
- 设置input的只读属性
- input设置为disabled提交后获取不到该值的解决方法
- input设置为disabled提交后获取不到该值的解决方法
- input设置为disabled提交后获取不到该值的解决方法
- input设置为disabled提交后获取不到该值的解决方法
- jquery设置input disabled属性的示例
- TextBox属性设置为只读后台获取不到值的问题
- TextBox属性设置为只读后台获取不到值的问题
- 获取checkbox的值传给后台
- input from 表单提交 使用 属性 disabled="disabled" 后台接收不到name="username"的值
- js 动态控制 input 框 的只读属性
- input 文本框密码框的只读属性
- 设置 取消input的disabled属性 getattribute(),setAttribute(),removeattribute()用法
- 表单提交设置disabled属性的input数据未提交
- 关于嵌入文本框设置只读后,后台获取不到值--解决办法
- asp.net中的服务器端控件 textbox 设为只读属性后无法获取 javascript给其赋的值
- jsp页面中input的disabled属性影响获取值的问题
- 学习canvas笔记,demo1,画个图标
- 【Objective-C基础】NSNumber,NSValue和NSData
- spring-boot项目的单元测试
- 待解决问题汇总(上日程)
- Toolbar使用踩坑记录
- javascript 设置input框只读属性 获取disabled后的值并传给后台
- CR1000编程系列01 搭建环境
- java中导入导出Excel表格(jxl的API应用)
- spring data简介
- 【Objective-C基础】自动释放池
- 被遗忘的技术点---JAVA
- 服务器进程fork两次原理
- srs之forward对接
- ubuntu16.04安装caffe以及各种问题汇总