页面:
<script type="text/javascript" language="javascript">
function NotNullName()
{
if(document.getElementById("txtName").value == "")
{
alert("请输入姓名");
return false;
}
}
</script>
后台:
ibtnFind.Attributes["onclick"] = "javascript:if(NotNullName()==false) return false;";就是一个很简单的验证,以前这样用好好的。但是有一天就不管了,我也发帖问了,需要做一下修改:页面:
<script type="text/javascript" language="javascript">
function NotNullName(txtID)
{
if(document.getElementById(txtID).value == "")
{
alert("请输入姓名");
return false;
}
}
</script>
后台:
ibtnFind.Attributes["onclick"] = "javascript:if(NotNullName('" + txtFind.ClientID + "')==false) return false;";现在发现原来写的所有类似的验证都不能用了,哪怕以前能用的现在也不能用了,想问下是什么原因。不想再把以前做的一个个修改了,有好多。
<script type="text/javascript" language="javascript">
function NotNullName()
{
if(document.getElementById("txtName").value == "")
{
alert("请输入姓名");
return false;
}
}
</script>
后台:
ibtnFind.Attributes["onclick"] = "javascript:if(NotNullName()==false) return false;";就是一个很简单的验证,以前这样用好好的。但是有一天就不管了,我也发帖问了,需要做一下修改:页面:
<script type="text/javascript" language="javascript">
function NotNullName(txtID)
{
if(document.getElementById(txtID).value == "")
{
alert("请输入姓名");
return false;
}
}
</script>
后台:
ibtnFind.Attributes["onclick"] = "javascript:if(NotNullName('" + txtFind.ClientID + "')==false) return false;";现在发现原来写的所有类似的验证都不能用了,哪怕以前能用的现在也不能用了,想问下是什么原因。不想再把以前做的一个个修改了,有好多。
改为
ibtnFind.Attributes["onclick"] = "NotNullName('" + txtFind.ClientID + "')"; 行不行
或者将document.getElementById('txtID').value 改为document.all('txtID').value