SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    confirm doesn't stop on cancel

    hello,
    i m trying to make a person stay on same page on cancel, but the confirm takes the user to the next page like they press ok. how can i stop it?
    <!--
    function ubs(){
    var check = confirm("Are You Sure?");
    if(check){
    redirect("http://www.yahoo.com/")
    }else{
    alert("Phew");
    }
    }
    //-->
    All those who wander aren't lost.

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    151 Post(s)
    Tagged
    3 Thread(s)
    You need to add a return false; statement to make sure nothing follows it
    Code:
    function ubs(){
    var check = confirm("Are You Sure?");
    if(check){
    redirect("http://www.yahoo.com/")
    }else{
    alert("Phew");
    return false;
    }
    }
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


Bookmarks

Posting Permissions

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