Jump to content

pinkopallino

Members
  • Posts

    3
  • Joined

  • Last visited

pinkopallino's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Finally I solved my problem.As you mentioned it is probably impossible to pause a javascript routine or function without execute the rest of the code in that page.So I used a different approach to obtain the same result (or, maybe, better).The code I posted was in a page I used to validate fields of a form and, also, to delete records of a database. In that case confirmation was necessary before record deletion.Now, I moved the confirmation window to the page that contains the form. Here I use the 'onclick' behavior:<a href="registration/abstrsubproc.asp?IDP=<% response.write(IDP) %> onclick="return confirm('Are you sure you want to delete this author?')"><img src="cancella.gif" width="12" height="12" border="0"></a>In this way, before the form post (and processing), it shows the confirmation window and, if you choose ok, redirects to the page that delete the specified record. Otherwise (cancel) no action will be taken.Thank you anyway._____P.S.: I hope you can understand my no so good English.
  2. Thank you, Chocolate570, for your replay.I also tried to compact the script as follow:<script language="JavaScript" type="text/javascript">{if (!confirm("Do you want to delete this author?")){window.history.back();}}</script>and, like the sample you posted, it works fine too but doesn't solve the problem.I realized that in my previous post I omitted an important detail that makes the difference in working or not. It is the response.redirect in the ASP code that follows the script (omitted before):<%' Response.EndRecordsetAuthors.deleteresponse.redirect("/index.asp?cont=abstract&act=mod&IDP=" & IDP & "&IDA=" & IDA & "&idx=" & idx)%>It redirects to another page without waiting for the user choose.What I expected, instead, was that the flow of my code paused inside the javascript until a user click (ok or cancel).Any idea to do so?
  3. I am new in javascript, so I need some help.I would like to insert a javascript within an ASP page. It shoud show a confirmation window before to delete a database record.I used this code:<% RecordsetAuthors.movefirst for i = 1 to btnID - 1 RecordsetAuthors.movenext next%><script language="JavaScript" type="text/javascript"> { var name=confirm("Do you want to delete this author?") if (name==true) { } else { window.history.go(-1); } }</script> <% ' Response.End RecordsetAuthors.delete%>Unfortunately this code doesn't show the confirmation window and goes directly to delete the record..The only way I found to do that, is to insert an ASP Response.End between the javascript and the rest of ASP code.Ih this case the ASP code execution stops and the confirmation window will show but the record will not be deleted, of course.Is there a way to show the confirmation window and stay there until you select ok or cancel button? Any suggestion will be very appreciated.
×
×
  • Create New...