Subscribe to
Posts
Comments

Taken from this blog is a technique which will postback the form when you hit enter. If you use the script below, it will work in any browser (although bypassing any onClick code for the button specified).

[javascript]
function clickButton(e, buttonid)
{
var bt = document.getElementById(buttonid);
if (typeof bt == ‘object’)
{
try
{
if(navigator.appName.indexOf(”Netscape”)>(-1))
{
if (e.keyCode == 13)
{
bt.click();
return false;
}
}
if (navigator.appName.indexOf(”Microsoft Internet Explorer”)>(-1))
{
if (event.keyCode == 13)
{
bt.click();
return false;
}
}
}
catch (er)
{
// invoke the default postback handler for buttons that render as tags
__doPostBack(buttonid,”);
}
}
}
[/javascript]

Leave a Reply