I am a newbie to JavaScript and I coded the following small JavaScript to make a postback function and its not working. I need anybody to correct it please.
C# code:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TextBox4.Text = "nopost";
}
else
{
TextBox4.Text = "post";
}
}
JavaScript:
<script type="text/javascript">
function a1(){
var hid = document.getElementById('TextBox4').Value;
if (hid == "post") {
alert('Posted');
}
else if (hid == "nopost") {
alert('Not Posted');
}
}
window.onload == function () {
a1();
}
</script>
ASP code
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
What's not workingread my question again and you can understand that I have issue with syntax as I am a niewbie.