function createCookie (name, value, days) {
    var expires;
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        expires = "; expires=" + date.toGMTString();
    } else {
        expires = "";
    }
    document.cookie = name + "=" + value + expires + "; path=/";
},
 
function readCookie (name) {
    var value = "; " + document.cookie,
    parts = value.split("; " + name + "=");
    if (parts.length === 2) {
        return parts.pop().split(";").shift();
    }
}
 
function eraseCookie (name) {
    createCookie(name, "", -1);
}

index

Пример:

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>



        <script>

            function createCookie(name, value, days) {
                var expires;
                if (days) {
                    var date = new Date();
                    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
                    expires = "; expires=" + date.toGMTString();
                } else {
                    expires = "";
                }
                document.cookie = name + "=" + value + expires + "; path=/";
            }

            function readCookie(name) {
                var value = "; " + document.cookie,
                        parts = value.split("; " + name + "=");
                if (parts.length === 2) {
                    return parts.pop().split(";").shift();
                }
            }

            function eraseCookie(name) {
                createCookie(name, "", -1);
            }
            
            createCookie("кука","wrwrwerwrwrwrwr",1);
            
            console.info(readCookie("кука"));
            
            var coo  = readCookie("кука2");
            if(coo === undefined){
                alert("банер");
                createCookie("кука2","1",1);
            }else{
               
            }

        </script>

    </body>
</html>