我在webform中的datalist项模板中的textbox加了个javascript脚本onchange,可是它不能正确工作,请教高手!!!部分客户端代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>数据录入</title>
<meta content="True" name="vs_snapToGrid">
<meta content="True" name="vs_showGrid">
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body bottomMargin="5" bgColor="#ffffff" topMargin="5" MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="tjtz_sjsr.aspx" language="javascript" onsubmit="if (!ValidatorOnSubmit()) return false;" id="Form1">
........
<script language="javascript" type="text/javascript" src="/aspnet_client/system_web/1_1_4322/WebUIValidation.js"></script>
.......
<tr>
<td nowrap="nowrap" style="background-color:#99FFFF;">
<span style="width:96px;"><input id="DataList_cw__ctl1_CheckBox_cw" type="checkbox" name="DataList_cw:_ctl1:CheckBox_cw" /><label for="DataList_cw__ctl1_CheckBox_cw">修改</label></span>
<span id="DataList_cw__ctl1_km_name" style="width:248px;">机修产值</span>
<span id="DataList_cw__ctl1_jldw" style="width:80px;">万元</span>
<input name="DataList_cw:_ctl1:TextBox_yue" type="text" id="DataList_cw__ctl1_TextBox_yue" onchange="javascript:this.parentElement.children(0).checked=true;" style="width:114px;" />
<span id="DataList_cw__ctl1_RegularExpressionValidator1" controltovalidate="DataList_cw__ctl1_TextBox_yue" errormessage="RegularExpressionValidator" display="Dynamic" evaluationfunction="RegularExpressionValidatorEvaluateIsValid" validationexpression="([\d-]+\.[\d-]+)|([\d-]+)" style="color:Red;width:98px;display:none;">只能输入数值</span>
<input name="DataList_cw:_ctl1:TextBox_yue_all" type="text" id="DataList_cw__ctl1_TextBox_yue_all" onchange="javascript:this.parentElement.children(0).checked=true;" style="width:114px;" />
<span id="DataList_cw__ctl1_RegularExpressionValidator2" controltovalidate="DataList_cw__ctl1_TextBox_yue_all" errormessage="RegularExpressionValidator" display="Dynamic" evaluationfunction="RegularExpressionValidatorEvaluateIsValid" validationexpression="([\d-]+\.[\d-]+)|([\d-]+)" style="color:Red;display:none;">只能输入数值</span>
</td>
</tr>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>数据录入</title>
<meta content="True" name="vs_snapToGrid">
<meta content="True" name="vs_showGrid">
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body bottomMargin="5" bgColor="#ffffff" topMargin="5" MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="tjtz_sjsr.aspx" language="javascript" onsubmit="if (!ValidatorOnSubmit()) return false;" id="Form1">
........
<script language="javascript" type="text/javascript" src="/aspnet_client/system_web/1_1_4322/WebUIValidation.js"></script>
.......
<tr>
<td nowrap="nowrap" style="background-color:#99FFFF;">
<span style="width:96px;"><input id="DataList_cw__ctl1_CheckBox_cw" type="checkbox" name="DataList_cw:_ctl1:CheckBox_cw" /><label for="DataList_cw__ctl1_CheckBox_cw">修改</label></span>
<span id="DataList_cw__ctl1_km_name" style="width:248px;">机修产值</span>
<span id="DataList_cw__ctl1_jldw" style="width:80px;">万元</span>
<input name="DataList_cw:_ctl1:TextBox_yue" type="text" id="DataList_cw__ctl1_TextBox_yue" onchange="javascript:this.parentElement.children(0).checked=true;" style="width:114px;" />
<span id="DataList_cw__ctl1_RegularExpressionValidator1" controltovalidate="DataList_cw__ctl1_TextBox_yue" errormessage="RegularExpressionValidator" display="Dynamic" evaluationfunction="RegularExpressionValidatorEvaluateIsValid" validationexpression="([\d-]+\.[\d-]+)|([\d-]+)" style="color:Red;width:98px;display:none;">只能输入数值</span>
<input name="DataList_cw:_ctl1:TextBox_yue_all" type="text" id="DataList_cw__ctl1_TextBox_yue_all" onchange="javascript:this.parentElement.children(0).checked=true;" style="width:114px;" />
<span id="DataList_cw__ctl1_RegularExpressionValidator2" controltovalidate="DataList_cw__ctl1_TextBox_yue_all" errormessage="RegularExpressionValidator" display="Dynamic" evaluationfunction="RegularExpressionValidatorEvaluateIsValid" validationexpression="([\d-]+\.[\d-]+)|([\d-]+)" style="color:Red;display:none;">只能输入数值</span>
</td>
</tr>
解决方案 »
- sql语句合并表的方法
- 请教下这里的SQL语句躲在哪里?
- 客户端和服务端的一些问题
- 网站前台打开有些动态页面,服务器cpu占用100%(而且等可长时间才能打开)
- 想深入 .net 的, 但是 想 深入 jscript .net 的, 要到那里找大本营?
- ActiveRtf中在编码格式中怎么没有gb2312,不能支持中文,谁能给我支持中文的
- 我想学习ASP.NET不知道是学习C#版的好还是VB.NET的好,请各位谈谈看法,谢谢
- ×××这段代码该如何写才能使得文件路径名是正确的?×××
- 存入session的DataReader数据如何取出?
- 快疯了~ 自定义服务器控件不能使用·#%#—……·#¥%—#
- 问一个纯数学的问题:已知四点A(Ax,Ay),B(Bx,By),C(Cx,Cy),D(Dx,Dy)的坐标,AB连成的直线与CD连成的直线相交于E,求E的坐标。
- 如何将asp.net的内容自动生成为shtml和HTML文件?
onblur
aspx:
--------
<asp:TextBox id="txtTest" Runat="server"></asp:TextBox>
cs文件:
------------------
//dataList1_ItemCreated事件
private void dataList1_ItemCreated(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
{
TextBox txt=(TextBox)e.Item.FindControl("txtTest");
//绑定onchange属性
if(txt!=null)
but.Attributes["onchange"]="javascript:this.parentElement.children(0).checked=true;";
}
的ASP.NET开发技巧集锦(一)之同时修改多笔数据