if I type the code as
[HTML]<input type="text" name="txtbox" >[/HTML]
and make the script language as
- function empty()
-
{
-
if(document.Form1.txtbox.value=="")
-
{
-
alert("should not be blank");
-
return false;
-
}
-
}
it works well , but If i give the same coding for a runat = "server" it does not work How should I do this ? Is there a possibility for getting the control by getElementById for TextBox as there is no "name" attribute present in ...
function tocheck()
{
var variable = document.getElementById("TextBox2").value;
if(isNaN(variable))
{
alert('not a numeric value');
}
}
//IN SIDE CODE BEHIND
Button1.Attributes.Add("onClick", " return tocheck()");
this works well but only after two ckicks why is it ?
thanks in advance