var sel = document.formname.selectname;
for(var i=0;i<sel.options.length;i++){
if(sel.options[i].value=="xxxx"){
sel.options[i].selected = true;
break;
}
}
for(var i=0;i<sel.options.length;i++){
if(sel.options[i].value=="xxxx"){
sel.options[i].selected = true;
break;
}
}
解决方案 »
- easyui-datagrid 撤销修改问题
- artDialog锁屏问题
- JS 点击了不能缩回去,求高人啊
- 用xmlHTTP.responseText遇到写错误!
- 菜鸟提问!在本机上有个bat文件会每天执行调用一个js新建一个以日期为文件名的文件夹,然后我在调用..........
- js或jquery获取屏幕高度
- 求一自动记录在线时间,按时间扣费的代码
- 如何编写qq秀(或Avatar)的代码?
- <a href="JavaScript:top.right.goRef('r_chap06.htm','rArendhorst')">Arendhorst</a>
- extjs4 itemselector如何获得选中行的值。
- 请问高手,可以用JS发送邮件吗?
- 请教一种弹出窗口的技术实现
问一下,可不可以设置DropDownList的属性值呢?
1、DropDownCheckList的控件名:CDept
2、窗体名为Form1。
var sel = document.Form1.Drp_CDept;
alert(sel);
for(var i=0;i<sel.options.length;i++)
{
if(sel.options[i].value=="1004")
{
sel.options[i].selected = true;
}
else if((ndave>1002)&&(ndave<1006)&&(sel.options[i].value =="1005"))
{
sel.options[i].selected =true;
}
else
{
sel.options[i].selected=false;
}
}
alert(sel)提示为NULL呀
if(typeof(objList)=="object")
{
var nCount=objList.children.item.length;
for(var i=0; i<nCount-1;i++)
{
var item=objList.children.item(0);
var chItem =item.children.item(i);
//
if ( typeof(chItem)=="object")
{
alert(chItem);
/*
if(item.children.item(i).value =="1004")
{
item.children.item(i).selected =true;
}
else if((ndave>1002)&&(ndave<1006)&&(objList.children.item(i).value =="1005"))
{
objList.children.item(i).selected =true;
}
else
{
objList.children.item(i).selected=false;
}*/
}
}
}
请问带注释部分怎么表达
for (int i = 0; i < ddclRank.Items.Count; i++)
{
ddclRank.Items[i].Selected = true;
}