wrexhamafc234
Programmer
I have the following javascript function in a seperate javascript file (javascript.js). Javascript.js is attacked in the masterpage:
This function is used when the return button is clicked on a textbox, I have added the following code to the page_load event on a aspx page:
However, when return is clicked on either of the above textboxes, the following button click is not executed.
Any ideas where i could be going wrong?
Code:
function IPressedEnterBasic()
{
if(event.which || event.keyCode)
{
if ((event.which == 13) || (event.keyCode == 13))
{
var save= confirm("Do you want to save?");
if (save == true)
{
document.getElementById("<%=SaveButton.ClientID%>").click();
}
else
{
return false;
}
}
}
else
{
return true;
}
}
This function is used when the return button is clicked on a textbox, I have added the following code to the page_load event on a aspx page:
Code:
Surname.Attributes.Add("onkeydown", "return IPressedEnterBasic();");
Forename.Attributes.Add("onkeydown", "return IPressedEnterBasic();");
However, when return is clicked on either of the above textboxes, the following button click is not executed.
Code:
protected void SaveButton_Click(object sender, EventArgs e)
{
}
Any ideas where i could be going wrong?