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 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question help to Call Function

    hi all

    well i need a litle help with a code ... i want that when the user enter 'cancel' on the confirm message the cookie is deleted. So if im correct and if is a good code the function for delete cookie is:

    function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT"
    }


    and i want to give a option at user for he/she delete the cookie. the problem is that i dont know the line code for call the function deletecookie

    for Know the code i have is:

    var stay=confirm("Hello " + name + "!" + " You have " + age + " years old. Press 'ok' if is correct, 'cancel' if not")
    if (!stay)
    [here the line code for call the function delete cookie if im correct, but i dont know what is]

    document.write ("Hi" + name )


    Thanks for the possible help (y))))

    Bye,

    Neo

  • #2
    Regular Coder
    Join Date
    Jul 2005
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You have to know the name of the cookie you want to delete. If the cookie name was "myCookie" then your code would look like this:
    Code:
    if (!stay)
        deleteCookie("myCookie");

  • #3
    New Coder
    Join Date
    Sep 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks .... sugestion for codingforums staff team :

    a "check up" in post's topic ... example here now my question is answered i change the " ? " in topic for a "(answered icon)"


    Bye all,

    Neo


  •  

    Posting Permissions

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