Hi David,
If you are using master page, please refer to the following code.
<%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="UseMaster.aspx.cs" Inherits="Test.WebForm2" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" onkeypress="SaveFocus('CheckBox1')"
Style="position: static" Text="aaa" />
<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="true" onkeypress="SaveFocus('CheckBox2')"
Style="position: static" Text="bbb" />
<asp:CheckBox ID="CheckBox3" runat="server" AutoPostBack="true" onkeypress="SaveFocus('CheckBox3')"
Style="position: static" Text="ccc" />
<asp:CheckBox ID="CheckBox4" runat="server" AutoPostBack="true" onkeypress="SaveFocus('CheckBox4')"
Style="position: static" Text="ddd" />
<input id="Hidden1" runat="server" type="hidden" value="" />
<script type="text/javascript">
function SaveFocus(checkboxid)
{
if (event.keyCode ==32)
{
var hidden = document.getElementById('<%= Hidden1.ClientID %>');
hidden.value = hidden.id.replace('Hidden1',checkboxid);
}
}
function StartUpScript()
{
if (document.getElementById('<%= Hidden1.ClientID %>').value != '')
{
document.getElementById(document.getElementById('<%= Hidden1.ClientID %>').value).focus();
}
}
</script>
</asp:Content>
********** Site1.Master
??.
<body onload="StartUpScript()">
??..
</body>
??.
By the way, both demo codes I provided in this thread work well on my machines. If there are something error on your side, please create a new page or new project and copy all the code without modification to test.
Sincerely,
Benson Yu
Microsoft Online Community Support
Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as Answer? if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.