string str = "体育";//这一项可以从数据库中读出
for (int j = 0; j < this.RadioButtonList1.Items.Count; j++)
{
if (str == this.RadioButtonList1.Items[j].Text.ToString())
{
this.RadioButtonList1.Items[j].Selected = true;
}
}
RadioButtonList取值写入数据库;
this.RadioButtonList1.SelectedValue
rblChk.SelectedValue = dt.Rows[0]["IsAudit"].ToString().ToLower() == "true" ? "1" : "0";
2、td无内容如何显示边框
当td为空时显示td的边线:给table加个border-collapse:collapse;给td加个empty-cells:show;都可以
当td里内容为空时,td的border边框样式将不被执行,于是便出现有的td没有边线的情况,可以通过给空td输 出 一个amp;nbsp;来解决
3、input文本框内灰色提示文本效果
<style type="text/css">
input{ width:200px; height:24px; line-height:24px; border:1px solid #999;
background:#ccc; margin:15px 0 0 100px; padding:4px; color:#666;}
.veryhuo_com{ background:#E0FEE4; border:1px solid #093;}
</style>
</head>
<body>
<input name="" type="text" value="请输入姓名:"/><br />
<input name="" type="text" value="请输入昵称:"/><br />
<input name="" type="text" value="输入验证码:"/><br />
<input name="" type="text" value="请输入手机号码:"/><br />
<input name="" type="text" value="请输入电子邮件:"/>
<script type="text/javascript">
var aInp=document.getElementsByTagName('input');
var i=0;
var sArray=[];
for(i=0; i<aInp.length; i++)
{
aInp[i].index=i;
sArray.push(aInp[i].value);
aInp[i].οnfοcus=function()
{
if(sArray[this.index]==aInp[this.index].value)
{
aInp[this.index].value='';
}
aInp[this.index].className='veryhuo_com';
};
// 烈火網 liehuo.net 欢迎复制,拒绝恶意采集 liehuo.net
aInp[i].οnblur=function()
{
if(aInp[this.index].value=='')
{
aInp[this.index].value=sArray[this.index];
}
aInp[this.index].className='';
};
}
</script>