Új hozzászólás Aktív témák

  • Joci93

    senior tag

    Próbálkozok még mindig a JS-es webshoppal, de még nem nagyon akar menni.
    A cookie-ba mentést/kiolvasást/törlést próbálom, de nem működik....

    Itt van a kód... én nem találtam benne hibát...

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


    <html lang="en">
    <head>

    <script type="text/javascript">


    function saveIt(name) {
    var x = document.forms['cookieform'].cookievalue.value;
    if (!x)
    alert('Please fill in a value in the input box.');
    else {
    Cookies.create(name,x,7);
    alert('Cookie created');
    }
    }

    function readIt(name) {
    alert('The value of the cookie is ' + Cookies[name]);
    }

    function eraseIt(name) {
    Cookies.erase(name);
    alert('Cookie erased');
    }

    function init() {
    for (var i=1;i<3;i++) {
    var x = Cookies['ppkcookie' + i];
    if (x) alert('Cookie ppkcookie' + i + '\nthat you set on a previous visit, is still active.\nIts value is ' + x);
    }
    }

    </script>


    </head>

    <body>

    <form name="cookieform" action="#"><p>
    Érték <input name="cookievalue" />
    </p></form>

    <p><a href="javascript:saveIt('ppkcookie1')" class="page">Create cookie 1</a><br />
    <a href="javascript:readIt('ppkcookie1')" class="page">Read cookie 1</a><br />
    <a href="javascript:eraseIt('ppkcookie1')" class="page">Erase cookie 1</a>.</p>






    </body>
    </html>

Új hozzászólás Aktív témák