Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    Hong Kong
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Javascripts Pop Up Message

    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

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    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>
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    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.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    Hong Kong
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to write the confirm() code?

    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

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts

    Re: How to write the confirm() code?

    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.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #6
    Regular Coder
    Join Date
    Aug 2002
    Location
    Hong Kong
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to write the confirm() code?

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

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts

    Re: Re: How to write the confirm() code?

    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
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #8
    Regular Coder
    Join Date
    Aug 2002
    Location
    Hong Kong
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Re: Re: Re: How to write the confirm() code?

    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •