In general, you need to make it so that if there is a visited cookie, then the code document.write("<h1>Успешно </h1>"); output document.write("<h1>Успешно </h1>"); , if there is no visited cookie, then the text of document.write("<h1>Ошибка </h1>"); was output document.write("<h1>Ошибка </h1>");

Closed due to the fact that off-topic participants Enikeyschik , LFC , freim , Anatol , Pavel Parshin 22 Feb at 20:51 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reasons:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Anatol, Pavel Parshin
  • " Learning tasks are allowed as questions only on the condition that you tried to solve them yourself before asking a question . Please edit the question and indicate what caused you difficulties in solving the problem. For example, give the code you wrote, trying to solve the problem "- Enikeyschik, LFC, freim
If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    You need to call the salutate() function:

     function salutate () { var cookies = document.cookie.split("; "); if (cookies.indexOf("visited") != -1) document.write("<h1>Успешно </h1>"); else document.write("<h1>Ошибка </h1>"); }