SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict sleepingdanny's Avatar
    Join Date
    Oct 2002
    Location
    Israel
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How To Do Confirm Function ??

    I have a link <a href="http://...">Logout</a>

    I need to know how to pop up an alert or something like that and ask the user if he is sure that he want's to logout and then if he clicks "OK" he will logout, but if he clicks "Cancle" he will not be sent anywhere...

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your script could go like this:
    function LogOut()
    {
    if(confirm("Are you sure?"))
    {location.href="somepage.html"}
    }

    <A HREF="javascript:LogOut()">Log Out</A>

    If they click ok then it will take them to the specified page, if they click cancel then nothing will happen.

  3. #3
    SitePoint Addict sleepingdanny's Avatar
    Join Date
    Oct 2002
    Location
    Israel
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks :-]


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
  •