html中checkbox选中则value为yes,没选中为no

来源:互联网 发布:与网络有关的词汇 编辑:程序博客网 时间:2024/05/21 06:29
Sencha Touch/Extjs中用html制作表单
html中checkbox选中则value为yes,没选中为no


<input type="text" name="text1">
<input type="text" name="text2">
<input type="text" name="text3">

<input name="checkbox1" type="checkbox" value="no" class="duigou">
<input name="checkbox2" type="checkbox" value="no" class="duigou">
<input name="checkbox3" type="checkbox" value="no" class="duigou">


1.首先获取所有的input框
var viewPort=Ext.Viewport.down('#视图ID')
var inputFields=viewPort.innerElement.dom.querySelectAll('input');//找到该视图下所有的input框


2.找到checkbox,判断有没有选中,选中则改变值为yes
for(var i = 0; i < inputFields.length; i++)
{
if(inputFields[i]['type']=='checkbox' && inputFields[i].checked)//是checkbox并且被选中,则改变值为


yes
{
inputFields[i].value='yes';
}
.....

}

http://blog.csdn.net/l863784757/article/details/15502069


0 0
原创粉丝点击