Задача простая - создать всплывающее окно которое будет показываться на сайте один раз за сессию, похимичив с кодом вот что получилось - смотрю через хром, там в куки попадает - но окно всплывает каждый раз,почему?
var cookie_value = 0
function get_cookie(name){
var cookie_name = name + "="
if (document.cookie.length > 0){
start_index = document.cookie.indexOf(cookie_name)
if (start_index != -1) {
start_index += cookie_name.length
end_index = document.cookie.indexOf(";", start_index)
if (end_index == -1){
end_index = document.cookie.length
}
cookie_value=unescape(document.cookie.substring(start_index, end_index))
}
}
if(cookie_value == 0){
document.cookie="pop_once = 1"
PopupMe()
}
}
function PopupMe(){
setTimeout('__PopupMe()',1000)
}
function __PopupMe(){
myleft=(screen.width)?(screen.width+500)/2:1;mytop=(screen.height)?(screen.height-200)/2:50;
settings='top=' + mytop + ',left=' + myleft +',width=250,height=150,location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=yes,fullscreen=no'
PopupWin=window.open('http://ampheek.com/popped.htm','PopupWin', settings);
PopupWin.focus();
setTimeout('PopupWin.close()',7000);}
0