0
我是Asp.Net的新手,我希望我的登錄頁面在按鈕上使用Java腳本進行驗證,但在.cs文件上。這裏是我的代碼:在代碼背後調用Javascript函數
<script type="text/javascript">
function CheckisEmpty()
{
var username = document.getElementById('txtUserName').innerHTML;
var password = document.getElementById('txtPwd').innerHTML;
if (username != '' || password != '')
{
return true;
}
else
{
alert("Feild Cannot Be Left Blank");
return false;
}
}
</script>
<asp:Button ID="btnLogin" Text="Login" runat="server" Width="120px" OnClick="btnLogin_Click" OnClientClick="return CheckisEmpty();" CssClass="button"></asp:Button>
btnLogin.Attributes.Add("OnClick", "CheckisEmpty()");
我在哪裏錯了?