Run C# code after running all javascript codes

samhaps6g

New Member
I am having a form in which a button is there on click of that button i am calling a javascript function in which i am displaying like 3.. 2.. 1 kind of effect then i am returning true.But after showing 3 only return true is getting executed and the form is getting submitted.How to stop form submitting before running the script.Edit:\[code\]function jsFun() { timerCount(3); //Calling the Timer Function. } var t; function timerCount(cDown) { if (cDown == 0) { clearTimeout(t); return true; } $('#<%= mainContainer.ClientID %>').html(cDown); cDown = cDown - 1; t = setTimeout('timerCount(' + cDown + ')', 1000); } <asp:Button ID="btnStarts" runat="server" Text="Start" OnClientClick="return jsFun();" OnClick="btn_click" />\[/code\]
 
Back
Top