Standard ASP-Back is sending the PostBack by calling a server event onClick. In your case, in the customer case onclick, you're returning false, so you're not letting the browser perform standard processing: sumbit.In order to cause a server event onClick through JavaScript, click can be simulated: click on the button cell. But since you already have a button with a processor. And there's either a flag that can be checked at the very beginning of countclick and raised after timeout'a. And a recipe after the flag's rise, i.e. in the same timeout'e:var isCallPostBack = false;
function countclick() {
if (isCallPostBack) // Когда флаг будет поднят, выполнится стандартная обработка
// Выполнится PostBack от кнопки, а значит сработает серверное событий OnClick
return true;
var btn = // Здесь нужно получить DOM-элемент кнопки.
// Либо через document.getElementById()
// Либо завести параметр метода
// Либо через this (только не забыть вызывать с нужным контекстом (call, apply))
intervalHandler = setInterval(count, 1000);
var handler=setTimeout(function () {
clearInterval(intervalHandler);
alert('стоп');
// Поднимаем флаг и вызываем клик на кнопке.
isCallPostBack = true;
btn.click();
}, 5000);
return false;
}
Either just redesign onclick in timeout's, and then no flags will be needed.