...

View Full Version : Javascripts Pop Up Message



victoria_1018
08-26-2002, 04:48 AM
Hi all,
I had a problem in creating an interactive box.
Below is the codes I used for the interactive box.

<Script>
var stay=confirm("Delete Report?? Please click ok to proceed or cancal
to go back to the main menu!")
if (stay)
window.location="DeleteReport2.asp"
else
window.location="main.asp"

</Script>

The program works without any bug. Although the program take me to the
main page after I had click cancal, but the selected report is deleted
at the same time.
What can I do to ensure the program only delete the report when I click
ok, and take me to the main menu without deleting the report when I
click cancal?
Thanks

Regards
Victotia

joh6nn
08-26-2002, 05:41 AM
try this:

<Script>
var stay = confirm("Delete Report?? Please click ok to proceed or cancal
to go back to the main menu!")
if (stay) {
window.location="DeleteReport2.asp";
}
else{
window.location="main.asp";
}

</Script>

glenngv
08-26-2002, 07:13 AM
i suspect that you put the javascript code in the same page where you have server-side code that deletes the report. The server-side code is executed first before the client side code. So even before the user clicks OK or Cancel, the report has been deleted. To be able to accomplish what you want, you have to put the confirm() dialog box in a different page, maybe in the displaying of the report page itself.

victoria_1018
08-26-2002, 07:38 AM
Hi Glenn,
Regarding the confirm() code, how should I write it, and where should I place it? Am I suppose to put the comfirm() code before deleteReport2.asp?
Thanks
Regards
victoria

glenngv
08-26-2002, 08:39 AM
it depends on your presentation of the report. Do you display the details of the report in a page, then there is a delete button to delete the report?
maybe you can provide more info on how you present the page to the user.

victoria_1018
08-26-2002, 09:00 AM
Hi,
I had sent the code to your personal email at yahoo. Thanks for taking your time ckecking my codes.
Thanks
Victoria

glenngv
08-26-2002, 09:31 AM
sorry but i can't check it right now, im in my office and mail sites like yahoo are restricted in our proxy. maybe you can post it here right now


Originally posted by victoria_1018
Hi,
I had sent the code to your personal email at yahoo. Thanks for taking your time ckecking my codes.
Thanks
Victoria

victoria_1018
08-26-2002, 09:41 AM
Hi,
It is very nice of you to ask me to post to codes to you now. However, since you are in the office, I am sure you have your works to complete. Anyway, there is still about a week before I have to submit this project, therefore, you may take your time to see my codes when you are free.
Thanks
Warmest Regards
Victoria:o



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum