在线等请高手帮忙谢谢
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script src="../../js/calendar.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="ch" runat=server type=checkbox value="水电工" />
<asp:TextBox ID="txtSJ2" runat="server" onclick="meizz_calendar(this)" onfocus="this.blur();"
Width="7%" CssClass="input2"></asp:TextBox>
</div>
</form>
</body>
</html>
想实现checkbox 选中时候 TextBox ID="txtSJ2" 可以填写.未选中不可填写
------解决方案-------------------- <input id= "ch " runat=server type=checkbox value= "水电工 " onclick= 'DoCheck(this, <%= this.txtSJ2.ClientID %> ) ' />
<script language= "javascript ">
function DoCheck(ctrl, id)
{
if(ctrl.checked)
{
document.all(id).disabled = false;
}
else
{
document.all(id).disabled = true;
}
}
</script>
------解决方案--------------------<input id= "ch " runat=server type=checkbox value= "水电工 " onclick= 'ch_onclick(this);' />
<script language= "javascript ">
function ch_onclick(obj)
{
if(obj.checked)
{
document.form1.txtSJ2.disabled = false;
}
else
{
document.form1.txtSJ2.disabled = true;
}
}
</script>
------解决方案--------------------加个name属性试试,IE6.0中,document.form1后面只能跟name属性,不能跟id。
如果想用id的话,就必须用getElementById