首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

好心人帮忙解决input的小疑点

2013-03-06 
好心人帮忙解决input的小问题就是input typetext 默认是不可填写东西的当我点击它前面的input typech

好心人帮忙解决input的小问题
就是input type="text" 默认是不可填写东西的   当我点击它前面的input type="checkbox" 才可以输入内容 请问如何实现
[解决办法]

<input type="checkbox" onclick="this.nextSibling.readOnly=!this.checked" /><input type="text" readonly="readonly" />

[解决办法]
<input type='checkbox' onclick="var t1=document.getElementById('t1'); if(this.checked) t1.disabled=false;else t1.disabled=true;" /><input id='t1' type='text' disabled=true />
[解决办法]
<input type="checkbox" onclick="document.getElementById('txt').readOnly=!this.checked" />
<input type="text" id="txt" readonly="readonly" />

版主的方法也可以,用这种比较保险一点。
[解决办法]
disabled属性的input是不会通过form传递的,用readonly属性不是挺好?

热点排行
Bad Request.