Code
<script type="text/javascript">
// $.cookie('test', 'my content', {expires: 365, path: '/'}); Создаём cookie
// $.cookie('test'); Получаем cookie
// $.cookie('test', null, {path: '/'}); Удаляем cookie
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') {
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString();
}
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};</script>
<script type="text/javascript">
$(document).ready(function set_tic() {
var t = $.cookie('change_tic');
if (t==null) { $('#tic').html('0'); $('#down_btn').css('display','none'); }
else
{
if (t==500) { $('#up_btn').css('display','none'); } else { $('#up_btn').css('display','inline-block'); }
if (t==0) { $('#down_btn').css('display','none'); } else { $('#down_btn').css('display','inline-block'); }
$('#tic').html(t);
}
});
function change_tic(act){
var t = $('#tic').text() * 1;
if (act=='+') { t = t + 10; } else { t = t - 10; }
$('#tic').text(t);
if (t==500) { $('#up_btn').css('display','none'); } else { $('#up_btn').css('display','inline-block'); }
if (t<=0) { $('#down_btn').css('display','none'); } else { $('#down_btn').css('display','inline-block'); }
$.cookie('change_tic', t, {expires: 365, path: '/'});
}
</script>
<div style="width:88px;height:31px;background: url('http://spichki.ucoz.ru/tic.png');margin:0;padding:0;">
<span style="z-index:11;width:88px;height:31px;position:absolute;margin-left:24px;"><img src="http://spichki.ucoz.ru/tic_up.png" id="up_btn" style="width:9px;height:10px;cursor:pointer;opacity:0.7;" onmouseover="$(this).animate({opacity: '1.0'}, 300);" onmouseout="$(this).animate({opacity: '0.7'}, 300);" onclick="change_tic('+');" /></span>
<span style="z-index:11;width:88px;height:31px;position:absolute;margin-left:24px;margin-top:15px;"><img src="http://spichki.ucoz.ru/tic_down.png" id="down_btn" style="width:9px;height:10px;cursor:pointer;opacity:0.7;" onmouseover="$(this).animate({opacity: '1.0'}, 300);" onmouseout="$(this).animate({opacity: '0.7'}, 300);" onclick="change_tic('-');" /></span>
<span style="z-index:10;width:74px;height:31px;position:absolute;margin-top:-3px;text-align:right;color:#000000;font-family:Times New Roman;font-size:22px;"><span style="border-bottom: 1px solid #000000;padding-bottom:4px;"><span style="border-bottom: 1px solid #000000;padding-bottom:2px;"><span style="border-bottom: 1px solid #000000;"><span id="tic"></span></span></span></span></span>