Вход

Просмотр полной версии : Кнопка вход на сайт!


Vendetta-V
14.09.2011, 10:14
Здраствуйте!

Есть такая проблемка!

Мне нужно реализовать кнопку входа на сайт(никакая авторизация и прочее), это просто кнопка не весь экран на домене www.site.com, когда нажимаешь появляеться сайт и ты спокойно далее его используешь.

Сайт на томже домене - www.site.com.

Очень надеюсь на вашу помощь! С уважением Андрей!:cray:

Kolyaj
14.09.2011, 10:34
Ради интереса: а зачем нужна такая кнопка?

Vendetta-V
14.09.2011, 10:55
Для юзабилити :blink:, ефектов никаких ненужно, просто картинка, нажимаешь вход и ты на сайте!

Я в скриптах не очень, я так понял нужно тут кукисы чтобы проблем небыло при возврате на главную ?!

Помогите плиз с созданием!

Snipe
14.09.2011, 11:04
<a href="сцылко"><img src="путь_к_картинке_кнопки"/></a>

Или какого рода кнопка нужна? %)

Kolyaj
14.09.2011, 11:13
Для юзабилити
У вас какое-то странное понятие о юзабилити. Т.е. по вашему мнению нажать на кнопку для входа на сайт удобней, чем сразу попасть на сайт?

Vendetta-V
14.09.2011, 11:29
У вас какое-то странное понятие о юзабилити. Т.е. по вашему мнению нажать на кнопку для входа на сайт удобней, чем сразу попасть на сайт?

Это не у меня такое мнение :write:, в преподавателя :-E

Vendetta-V
14.09.2011, 11:31
<a href="сцылко"><img src="путь_к_картинке_кнопки"/></a>

Или какого рода кнопка нужна? %)

Так нужно :

Див блок на весь экран с БГ картинкой!

и посередине такая кнопка как вы указали(картинка-ссылка) !!! :thanks:

Vendetta-V
14.09.2011, 12:46
Хелп!

Snipe
14.09.2011, 12:50
Эм, что хелп то?
Если вы просите сделать за вас такую страничку, с большоай долей вероятности вам в раздел "Работа".
Если вам нужна помощь, то напишите, что вы сделали и что у вас не получилось...

Vendetta-V
14.09.2011, 12:59
Есть страничка сама , но как её связать с индекс файлом, чтобы она только раз показывалась пользлвателю?

melky
14.09.2011, 13:03
зачем две страницы ? не легче ли на странице вывести блок на всю ширину и высоту, а при нажатии на него (или на кнопку) скрывать его и запоминать скрытие?

dmitriymar
14.09.2011, 13:15
Есть страничка сама , но как её связать с индекс файлом, чтобы она только раз показывалась пользлвателю?
назвать её index.html и создать куки при нажатии на неё.какие при всяком входе проверять-есть -не показывать ,нет-показать

Vendetta-V
14.09.2011, 13:35
запоминать скрытие?


Как запомнить скрытие?

melky
14.09.2011, 13:44
cookies or localStorage.

google it.

Vendetta-V
14.09.2011, 15:01
<script type="text/javascript">
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name)
{
return unescape(y);
}
}
}

function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}

function checkCookie()
{
var username=getCookie("username");
if (username!=null && username!="")
{
document.getElementById('intro').style.visibility = "hidden";
document.getElementById('wraper').style.visibility = "visible";
setCookie("username",username,365);
}
else
{
document.getElementById('intro').style.visibility = "visible";
document.getElementById('wraper').style.visibility = "hidden";
if (username!=null && username!="")
{
setCookie("username",username,365);
}
}
}
</script>
<body <?php body_class(); ?>>
<?php if(is_front_page()) { ?>
<div id="intro" style="position:absolute;width:100%;height:100%; background:url(images/intro_background.jpg) top left no-repeat">
<img src="<?php bloginfo('templste_directory') ?>/images/intro_play_btn.jpg" onClick="document.getElementById('intro').style.visibility = 'hidden';
document.getElementById('wrapper').style.display = 'visible';">
</div>
<?php } ?>

Нашел такой скриптец по установки куков!

Немного подкоректировал, но нужна помощь ещё...

чтобы установить кику при клике на картинку...


Хелп плиз!!!!

Vendetta-V
14.09.2011, 15:19
function checkCookie()
{
var username=getCookie("username");
if (username!=null && username!="")
{
document.getElementById('intro').style.visibility = "hidden";
document.getElementById('wraper').style.visibility = "visible";
setCookie("username",username,365);
}
else
{
document.getElementById('intro').style.visibility = "hidden";
document.getElementById('wraper').style.visibility = "visible";
if (username!=null && username!="")
{
setCookie("username",username,365);
}
}
}
</script>
<body <?php body_class(); ?> onload="checkCookie()">
<?php if(is_front_page()) { ?>
<div id="intro">
<img src="wp-content/themes/theme/images/intro_play_btn.jpg" onClick="setCookie("username",username,365)">
</div>
<?php } ?>


Последний фрагмент так сделла
но вот результат - http://ct-logistics.net/

Vendetta-V
14.09.2011, 15:20
melky,
Помогите подредактировать!!!

Vendetta-V
14.09.2011, 16:28
function checkCookie2()
{
var username=getCookie("username");
if (username!=null && username!="")
{
document.getElementById('intro').style.visibility = "hidden";
}
else
{
document.getElementById('intro').style.visibility = "visible";
}
}
</script>
<body <?php body_class(); ?> onLoad="checkCookie2()">
<?php if(is_front_page()) { ?>
<div id="intro" style="visibility:hidden;">
<img src="wp-content/themes/theme/images/intro_play_btn.jpg" onClick="setCookie('username',username,365);checkCookie2()">
</div>
<?php } ?>

сделал вот так но картинка не пропадает

melky
14.09.2011, 18:14
а у меня работает :)

только значение куки "undefined" (строка)

Александр х@к
14.09.2011, 20:04
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Модальное окно</title>
<style type="text/css">
body {margin:0; padding:0}
h1, h2 {text-align:center; color:#f00}
p {margin:0; text-align:justify; text-indent:1.5em}
#content {padding:5px}

/* черная полупрозрачная подложка */
#modall {
display:none;
position:absolute;
width:100%;
text-align:center;
}
/* для нормальных браузеров */
/* IE 6 не понимает спецификатора дочернего селектора > */
body > #modall {
background-color:#000;
-moz-opacity: 0.2; /* код для движков Mozilla */
opacity:.20;
}

/* псевдоокно */
#formm {
display:none;
position:absolute;
width:400px;
height:200px;
margin:auto;
padding:20px;
text-align:left;
background-color:#fff;
}

/* прикрасы */
.login {margin-left:39px}
.pass {margin-left:32px}
.style1 {
font-family: "Courier New", Courier, monospace;
white-space: nowrap;
background-color: #ccc;
}
</style>
<!--[if IE]>
<style type="text/css">
#modall {filter: Alpha(Opacity=20); background-color:#000;}
</style>
<![endif]-->
<script type="text/javascript">
var timer = null;
var opacity = 20;
function show_modall ()
{
// нагромождение с низким поклоном Великому Биллу
// для нормальных браузеров достаточно window.innerHeight
var height = (window.innerHeight? window.innerHeight:
(document.documentElement.clientHeight? document.documentElement.clientHeight:
document.body.offsetHeight));
var width = (window.innerWidth? window.innerWidth:
(document.documentElement.clientWidth? document.documentElement.clientWidth:
document.body.offsetWidth));

var top = Math.ceil(height / 2 - 110); // 110 - половина высоты окна с формой, включая padding
var left = Math.ceil(width / 2 - 210); // 210 - половина ширины окна с формой, включая padding
// устанавливаем черный полупрозрачный блок на весь экран
document.getElementById ("modall").style.height = height+"px";
// делаем его видимым
document.getElementById ("modall").style.display = 'block';
// позиционируем псевдоокно по высоте
document.getElementById ("formm").style.top = top+"px";
document.getElementById ("formm").style.left = left+"px";
// делаем его видимым
document.getElementById ("formm").style.display = 'block';
// "проявляем" затенение
timer = setInterval ("shadow()", 1);
}

function shadow ()
{
document.getElementById ("modall").style.opacity = opacity++ / 100;
document.getElementById ("modall").style.MozOpacity = opacity / 100;
document.getElementById ("modall").style.filter = "Alpha(Opacity="+opacity+")";
if (opacity >= 80)
clearInterval (timer);
}
</script>
</head>

<body>
<div id="modall"></div>
<div id="formm">

</div>
</div>
<div id="content">
<input type="button" onclick="show_modall()" value="Показать окно" /></p>
</div>
</body>
</html>

CSS(просто чтоб знал, этого в коде не надо)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Модальное окно</title>
<style type="text/css">
body {margin:0; padding:0}
h1, h2 {text-align:center; color:#f00}
p {margin:0; text-align:justify; text-indent:1.5em}
#content {padding:5px}

/* черная полупрозрачная подложка */
#modal {
display:none;
position:absolute;
width:100%;
text-align:center;
}
/* для нормальных браузеров */
/* IE 6 не понимает спецификатора дочернего селектора > */
body > #modal {
background-color:#000;
-moz-opacity: 0.2; /* код для движков Mozilla */
opacity:.20;
}

/* псевдоокно */
#form {
display:none;
position:absolute;
width:400px;
height:200px;
margin:auto;
padding:20px;
text-align:left;
background-color:#fff;
}

/* прикрасы */
.login {margin-left:39px}
.pass {margin-left:32px}
.style1 {
font-family: "Courier New", Courier, monospace;
white-space: nowrap;
background-color: #ccc;
}
</style>
<!--[if IE]>
<style type="text/css">
#modal {filter: Alpha(Opacity=20); background-color:#000;}
</style>
<![endif]-->
<script type="text/javascript">
var timer = null;
var opacity = 20;
function show_modal ()
{
// нагромождение с низким поклоном Великому Биллу
// для нормальных браузеров достаточно window.innerHeight
var height = (window.innerHeight? window.innerHeight:
(document.documentElement.clientHeight? document.documentElement.clientHeight:
document.body.offsetHeight));
var width = (window.innerWidth? window.innerWidth:
(document.documentElement.clientWidth? document.documentElement.clientWidth:
document.body.offsetWidth));

var top = Math.ceil(height / 2 - 110); // 110 - половина высоты окна с формой, включая padding
var left = Math.ceil(width / 2 - 210); // 210 - половина ширины окна с формой, включая padding
// устанавливаем черный полупрозрачный блок на весь экран
document.getElementById ("modal").style.height = height+"px";
// делаем его видимым
document.getElementById ("modal").style.display = 'block';
// позиционируем псевдоокно по высоте
document.getElementById ("form").style.top = top+"px";
document.getElementById ("form").style.left = left+"px";
// делаем его видимым
document.getElementById ("form").style.display = 'block';
// "проявляем" затенение
timer = setInterval ("shadow()", 1);
}

function shadow ()
{
document.getElementById ("modal").style.opacity = opacity++ / 100;
document.getElementById ("modal").style.MozOpacity = opacity / 100;
document.getElementById ("modal").style.filter = "Alpha(Opacity="+opacity+")";
if (opacity >= 80)
clearInterval (timer);
}
</script>
</head>

<body>
<div id="modal"></div>
<div id="form">
<form>
123
</form>
</div>
</div>
<div id="content">
<input type="button" onclick="show_modal()" value="Показать окно" /></p>
</div>
</body>
</html>





При нажатии на "Показать окно" появляется серо-черная подложка.

А ты сделай наоборот
Автомат.выводит подложку, жмешь на "войти"(вместо "показать окно")
и сайт размещаешь за подложкой

З.Ы."войти" расположить в диве