Скрипт проверка возраста
Подскажите пожалуйста что надо сделать чтобы при нажатии на
"Нет 18 лет" выводилась надпись "Уходите с сайта" a "Мне 18 лет" форма проверки возраста скрывалась // Возраст посетителя менее 18 лет. watch_site_denyed_url = ''; // Возраст посетителя больше 18 лет. watch_site_url = ''; // Время жизни cookie поситителя. hours_expire = 48; template = '<style type="text/css">' + ' .ajtable {' + ' width: 500px;' + ' height: 200px;' + ' position:fixed;'+ ' top:78%;'+ ' left:35%;'+ ' background-color: #fff8e9;' + ' color: #490514;' + 'border:2px solid #490514;'+ 'border-radius: 15px;'+ 'font-family:Arial,Helvetica,sans-serif;'+ 'opacity:0.8;'+ 'margin-left:240px;'+ 'margin:auto;'+ 'display:block;'+ 'z-index:150;'+ ' }' + ' .headtext {' + ' font-size: 18px;' + ' text-align: center;' + ' }' + ' #lp { text-align: left; }' + ' #rp { text-align: right; }' + ' #lp input {' + ' background: url(img/header-main-menu_bg.png) repeat-x;' + 'height:28px;color:#fff;font-size: 14px;'+ ' }' + ' #rp input {' + ' background: url(img/header-main-menu_bg.png) repeat-x;' + 'height:28px;color:#fff;font-size: 14px;'+ ' }' + ' .ajtable input {' + ' border: 0px;' + ' width: 138px;' + ' height: 56px;' + ' color: #ffffff;' + ' font-size: 24px;' + ' cursor: pointer;' + ' }' + '.default_6{'+ 'display:none;'+ ' }' + '</style>' + '<table cellspacing="25" cellpadding="0" class="ajtable">' + ' <tr><td colspan="2" class="headtext">Информация представленная на сайте, ' + 'ограниченна для просмотра лицам не' + 'достигшими 18 лет.<BR/><BR/>Подтвердите ваш возраст<BR/><BR/></td></tr>' + ' <tr>' + ' <td id="lp"><input type="button" value="Нет 18 лет" onclick="agejs(\'<18\');" /></td>' + ' <td id="rp"><input type="button" value="Мне 18 лет" onclick="agejs(\'>18\');" /></td>' + ' </tr>' + '</table>'; function agejs(visitor_age) { var current_date = new Date(); var expire_date = new Date(current_date.getTime()+hours_expire*60*60*1000); document.cookie = 'age_visitor='+visitor_age+';expires='+expire_date; document.getElementById('agejs_').innerHTML = ''; if( visitor_age == '<18' ) { window.location.href = watch_site_denyed_url; } else { window.location.href = watch_site_url.style.display = 'none'; } } function getCookie() { var cookie_array = new Array(); var cookie_elems = document.cookie.split(/;\s?/); var value_index = 0; while( cookie_elems[value_index] ) { var elem = cookie_elems[value_index].match(/(.+)=(.*)/); cookie_array[elem[1]] = elem[2]; value_index++; } return cookie_array; } window.onload = function () { var ck = getCookie(); var val = ck['age_visitor']; if( val == undefined ) { document.getElementById('agejs_').innerHTML = template; } else if ( val == "<18" ) { window.location.href = watch_site_denyed_url; } else { window.location.href = watch_site_url; } } |
Часовой пояс GMT +3, время: 16:54. |