Выводим блок новостей вашего сайта в верхней части сайта. Скрипт уникален и не обычен на первый взгляд.
Установка:
ПУ => Страницы сайта и в любое место:
В таблицу стилей вашего сайта:
Этот код вставляем в любое место:
Установка:
ПУ => Страницы сайта и в любое место:
Code
<div id="site-news-panel"><div id="site-news-cont-img"></div><div id="site-news-cont">Авторские скрипты для ucoz - "ucodes.ru" сайт направлен на написание как платных так и бесплатных скриптов для системы uCoz //.</div><a href="#" onclick="showHide();" id="site-news-cont-close"></a></div>
В таблицу стилей вашего сайта:
Code
#site-news-panel {background:#507c96;width:100%;min-height:30px;color:#fff;box-shadow: 0 4px 10px #444;positon:absolute !important;}
#site-news-cont {padding: 7px 0px 7px 5px;text-align:left;float:left;}
#site-news-cont-img {background: url(http://www.effect-club.ru/public/img/b.png) no-repeat -17px 0px;width:11px;height:9px;float:left;margin: 5px 0px 0px 7px;}
#site-news-cont-close {background: url(http://www.effect-club.ru/public/img/b.png) no-repeat;width:16px;height:18px;float:right;margin: 6px 10px 0px 0px;display:block}
#site-news-cont {padding: 7px 0px 7px 5px;text-align:left;float:left;}
#site-news-cont-img {background: url(http://www.effect-club.ru/public/img/b.png) no-repeat -17px 0px;width:11px;height:9px;float:left;margin: 5px 0px 0px 7px;}
#site-news-cont-close {background: url(http://www.effect-club.ru/public/img/b.png) no-repeat;width:16px;height:18px;float:right;margin: 6px 10px 0px 0px;display:block}
Этот код вставляем в любое место:
Code
01
<script type="text/javascript">
02
var elementId = 'site-news-panel';
03
function setCk (a,b,c) {
04
if (a) {
05
var date = new Date();
06
date.setTime(date.getTime() + (c * 24 * 60 * 60 * 1000));
07
document.cookie = a + '=' + escape(b) + '; expires="' + (date.toGMTString()) + '"; path="/"';
08
}
09
else
10
return null;
11
}
12
13
function getCk(a) {
14
var name = a + "=";
15
var ca = document.cookie.split(';');
16
for (var i = 0; i < ca.length; i++) {
17
var c = ca[i];
18
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
19
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
20
}
21
return null;
22
}
23
function showHide () {
24
if (document.getElementById(elementId).style.display == '') {
25
document.getElementById(elementId).style.display = 'none';
26
setCk(elementId, 1, 1);
27
} else {
28
document.getElementById(elementId).style.display = '';
29
setCk(elementId, 0, 1);
30
}
31
}
32
if (getCk(elementId) == 1) {
33
document.getElementById(elementId).style.display = 'none';
34
}
35
</script>
<script type="text/javascript">
02
var elementId = 'site-news-panel';
03
function setCk (a,b,c) {
04
if (a) {
05
var date = new Date();
06
date.setTime(date.getTime() + (c * 24 * 60 * 60 * 1000));
07
document.cookie = a + '=' + escape(b) + '; expires="' + (date.toGMTString()) + '"; path="/"';
08
}
09
else
10
return null;
11
}
12
13
function getCk(a) {
14
var name = a + "=";
15
var ca = document.cookie.split(';');
16
for (var i = 0; i < ca.length; i++) {
17
var c = ca[i];
18
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
19
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
20
}
21
return null;
22
}
23
function showHide () {
24
if (document.getElementById(elementId).style.display == '') {
25
document.getElementById(elementId).style.display = 'none';
26
setCk(elementId, 1, 1);
27
} else {
28
document.getElementById(elementId).style.display = '';
29
setCk(elementId, 0, 1);
30
}
31
}
32
if (getCk(elementId) == 1) {
33
document.getElementById(elementId).style.display = 'none';
34
}
35
</script>
Источник: http://ucodes.ru