下拉菜单select,怎么设置默认值? 本帖最后由 viphk 于 2010-12-21 20:07:04 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 有个selected属性把它设成TRUE就行了 添加 for(var i = 0; i<mArray.length; i++){ $('#select1).append($("<option value='"+mArray[i]+"'>"+mArray[i]+"</option>"));} 默认值option value="" selected="selected" 在你的代码后加一句:Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "document.getElementById('yc').value =" + yc, true); select里或者页面其它地方还要不要添加什么属性吗? Response.Write("是否换行:<select name=\"br\" id=\"br\"><option value=\"1\" selected=\"true\">是</option><option value=\"0\">否</option></select><br/>"); 加了都没有效果的,现在问题已解决,谢谢大家的帮助,我这么做的;string br = row["index_br"].ToString();int selebrr = 0;string selectedbrr = "<option value=\"1\">是</option><option value=\"0\" selected=\"selected\">否</option>";if (br == "True"){selebrr = 1;selectedbrr = "<option value=\"1\" selected=\"selected\">是</option><option value=\"0\">否</option>";}是否换行:<select name=\"brr\" value=\"" + selebrr + "\">" + selectedbrr + "</select> } 这不可能!可能你用了微软的AJAX! RichTextBox 如何得到当前鼠标所在的们置 谢谢 Visual Studio开发工具实现拖控件自动在Designer.cs生成相应代码的原理是什么? 请大家进来指导一下--------------多谢了! 进程挂起问题 在TreeView 中为何选中不了需要的记录 关于windows 服务 的问题 为什么老是报"加载报表失败!!!" ????? 如何将DATAGRID限定为只能输入5行,再输入数据提示。 覓高手-廣州 vs编译器问题 学习C#看些什么代码好啊? ????如何反编译dll????
$('#select1).append($("<option value='"+mArray[i]+"'>"+mArray[i]+"</option>"));
}
默认值option value="" selected="selected"
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "document.getElementById('yc').value =" + yc, true);
Response.Write("是否换行:<select name=\"br\" id=\"br\"><option value=\"1\" selected=\"true\">是</option><option value=\"0\">否</option></select><br/>");
我这么做的;
string br = row["index_br"].ToString();
int selebrr = 0;
string selectedbrr = "<option value=\"1\">是</option><option value=\"0\" selected=\"selected\">否</option>";
if (br == "True")
{
selebrr = 1;
selectedbrr = "<option value=\"1\" selected=\"selected\">是</option><option value=\"0\">否</option>";
}
是否换行:<select name=\"brr\" value=\"" + selebrr + "\">" + selectedbrr + "</select>
}
可能你用了微软的AJAX!