Et alternativt eksempel...
<SCRIPT LANGUAGE=\"JavaScript\">
<!--
function Get_Cookie(name) {
var start = document.cookie.indexOf(name+\"=\");
var len = start+name.length+1;
if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
if (start == -1) return null;
var end = document.cookie.indexOf(\";\",len);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(len,end));
}
function Set_Cookie(name,value,expires,path,domain,secure) {
document.cookie = name + \"=\" +escape(value) + ( (expires) ? \";expires=\" + expires.toGMTString() : \"\") + ( (path) ? \";path=\" + path : \"\") + ( (domain) ? \";domain=\" + domain : \"\") + ( (secure) ? \";secure\" : \"\");
}
function AllowAccess(clix, lnk) {
if (clix < lnk) {
alert(\"Du har ikke adgang til dette link !\\nDu har nu adgang til Link : \" + clix + \".\");
return false;
} else {
Set_Cookie(\'clix\', lnk+1);
return true;
}
}
Set_Cookie(\'clix\', 1);
//-->
</SCRIPT>
<BASE TARGET=\"_blank\">
<A HREF=\"
http://www.ljweb.com\" onclick=\"return (AllowAccess(Get_Cookie(\'clix\'), 1))\" onFocus=\"this.blur()\">Link 1</A><BR>
<A HREF=\"
http://www.ljweb.com\" onclick=\"return (AllowAccess(Get_Cookie(\'clix\'), 2))\" onFocus=\"this.blur()\">Link 2</A><BR>
<A HREF=\"
http://www.ljweb.com\" onclick=\"return (AllowAccess(Get_Cookie(\'clix\'), 3))\" onFocus=\"this.blur()\">Link 3</A><BR>
<A HREF=\"
http://www.ljweb.com\" onclick=\"return (AllowAccess(Get_Cookie(\'clix\'), 4))\" onFocus=\"this.blur()\">Link 4</A><BR>