I want to set a cookie when an <a> is clicked. The cookie for the numerous a's will be set as checked. If all the cookies has been set to checked, an alert box will open. I've started for example with this simple html and javascript:

function setSessionCookie1() {
document.cookie="cookie1" + checked;

function setSessionCookie2() {
document.cookie="cookie2" + checked;

function CheckIfCookiesAreChecked() {
if (cookie1=checked, cookie2=checked) {
alert ("Both the <a>'s have been clicked");

<a href="page1.html" onclick="setSessionCookie1">Click here for page 1</a>
<a href="page2.html" onclick="setSessionCookie2">Click here for page 2</a>

I know the code doesn't work above, but my question is how to get it to work.

How do I set an <a> on checked after onclick, and how do I properly check if the <a>'s have been checked so JavaScript knows when to show the alert?