Подскажите в чём ошибка
кука не сохраняеться (видимо проблема в setCookie() )
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
window.onload = function(){
if(getCookie('test')) document.getElementById("og").innerHTML = getCookie('test');
}
function getCookie(name) {
var cookie = " " + document.cookie;
var search = " " + name + "=";
var setStr = null;
var offset = 0;
var end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = cookie.indexOf(";", offset)
if (end == -1) {
end = cookie.length;
}
setStr = unescape(cookie.substring(offset, end));
}
}
return(setStr);
}
function setCookie(){ //o!!!
if(arguments[0] && arguments[1]){
document.cookie = arguments[0] + "=" +
arguments[1] +
((arguments[2]) ? "; expires=" + arguments[2] : "") +
((arguments[3]) ? "; path=" + arguments[3] : "") +
((arguments[4]) ? "; domain=" + argumtns[4] : "");
}
}
function delCookie(name){
setCookie(name,"");
}
function alibaba(){
setCookie("test",prompt("value"));
}
</script>
</head>
<body>
<p id="og">Результат</p>
<a href="#" onclick="alibaba()">setCookie</a>
</body>
</html>