fungsi clearcookie () {var kedaluwarsa = tanggal baru (); Expires.setTime (Expires.getTime () - 1000); // Kurangi satu detik dari waktu saat ini setara dengan kedaluwarsa segera (dapat ditambahkan atau dikurangi) dokumen.cookie = "appCode = '222' '' '; path =/; kedaluwarsa =" + kedaluwarsa.togmtstring () + ""; // Kedaluwarsa adalah pengaturan yang sesuai dengan waktu kedaluwarsa. If this value is not set, the cookie is invalid by default when closing the browser document.cookie = "roleID='333''''';path=/;expires=" + expires.toGMTString() + "";document.cookie = "parentMenuID='000'''';path=/;expires=" + expires.toGMTString() + ""; document.cookie = "currentMenuname = 'haha' '' ''; path =/; kedaluwarsa =" + kedaluwarsa.togmtString () + "";}jalur =/; berarti bahwa lokasi di mana cookie disimpan adalah direktori root browser.
Metode di atas menyebabkan keempat cookie kode appc, roleid, parentmenuid, arusMenuname menjadi tidak valid.