Thank you for your reply.
After applying the code example as posted, IE 7 reports a stack
overflow error, and FF does not work.
To answer your questions:
-Are these buttons marked as type="Submit" or type="button"?
+the buttons are marked as "submit" buttons.
-Do they cause navigation/posting?
+I don't know how to answer this. I do know they are submit buttons
for a form with runat=server, and the buttons themselves are
asp:textbox'es
-Why not use onkeyup?
+The code I am using was provided from another tuturial.
-Does FF3 have an event object?
+I don't know this answer.
Thank you for your help.
> Thank you for your reply.
> After applying the code example as posted, IE 7 reports a stack
> overflow error, and FF does not work.
Oops bad choice of function name change onkeyup function to body_onkeyup.
Also ev.keyCode might need to be ev.which
I'll do some testing when I get the chance
> To answer your questions:
>
> -Are these buttons marked as type="Submit" or type="button"?
> +the buttons are marked as "submit" buttons.
So the form is posted the page reloaded?
> -Do they cause navigation/posting?
> +I don't know how to answer this. I do know they are submit buttons
> for a form with runat=server, and the buttons themselves are
> asp:textbox'es
They will be posting if the containing form has an action attribute (you can
see if it does using view source)
> -Why not use onkeyup?
> +The code I am using was provided from another tuturial.
The problem with keydown is it is more prone to fire repeatedly.
> -Does FF3 have an event object?
> +I don't know this answer.
No it doesn't but on thing I didn't know is that event is found in the scope
chain when executing code in HTML event attribute. So thats ok.

Signature
Anthony Jones - MVP ASP/ASP.NET
psion - 26 Mar 2008 21:42 GMT
Hi Anthony,
After applying the changes, neither IE7 nor FF3 work.
To answer your question:
-So the form is posted the page reloaded?
+Yes, the form is posted and reloaded.
The original code works with some minor changes. Here is a solution
that seems to work in both IE7:
~login aspx
****************************************
//FOCUSING
//var toSubmit = "btnLogin";
var toSubmit = null;
function setSubmit(x){
if (x==1){
toSubmit = "btnLogin";
}else if (x==2){
toSubmit = "btn_reminder";
}else if (x==3){
toSubmit = "btn_tn_search";
}else{
toSubmit = "none";
}
}
function goSubmit(){
//if (toSubmit != "none")
document.getElementById(toSubmit).click();
return false;
}
<body id="body1" runat="server" onkeyup="if((event.which &&
event.which == 13) || (event.keyCode && event.keyCode == 13))
{goSubmit();}">
<form id="frmindex" method="post" runat="server"
onsubmit="if((event.which && event.which == 13) || (event.keyCode &&
event.keyCode == 13)){goSubmit();}">
~login vb
****************************************
Me.txtUser.Attributes.Add("onfocus", "javascript:setSubmit(1);")
Me.txtPass.Attributes.Add("onfocus", "javascript:setSubmit(1);")
Me.txt_reminder.Attributes.Add("onfocus", "javascript:setSubmit(2);")
NOTE: A slight change has to be made in the above code for FF3 to
work. The onkeyup -> onkeydown only for body tag:
<body id="body1" runat="server" onkeydown=
Thanks for your help.
Krzysztof