Jump to content
  • 0

Всплывающее Диалоговое окно


Kiriklk
 Share

Question

Добрый вечер! Как сделать такое окно как на этом сайте? http://winestyle.ru/

Т.е. когда заходишь на сайт он спрашивает Есть ли Вам 18 лет? А затем при нажатии на крестик окно не исчезает и блокирует все действия кроме прокрутки страницы? Дайте хотя бы направление в котором искать. Буду очень благодарен!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

когда-то давно делал:
 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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">html, body {	height:100%;	margin:0;	padding:0;}.main_hide {	position: relative;}.show_hide {	height: 1000px;}#shadow {	display: block;	background: url(grid.gif);	position: absolute;	top: 0;	left: 0;	width: 100%;	height: 100%;}#denied {	display: none;	background: #252525;	position: absolute;	width: 250px;	height: 60px;	top: 0;	left: 0;}.denied_title {	font: bold 14px Verdana;	color: #2166C2;	margin: 15px auto;	width: 215px;}.years_center {	width: 250px;	height: 60px;	position: absolute;	top: 400px;	left: 500px;}.title_years {	font: bold 14px Verdana;	color: #2166C2;	margin: 0 auto;	width: 140px;}#yes {	width: 100px;	height: 40px;	display: block;	float: left;	margin-right: 10px;	background: url(yes.png);}#no {	width: 100px;	height: 40px;	display: block;	float: left;	margin-left: 10px;	background: url(no.png);}</style></head><body><div class="main_hide">    <div class="show_hide">	А это <a href="http://www.mysite.com">ссылка</a> по которой нельзя будет кликнуть после нажатия на кнопку.    </div>    <div id="shadow">	<div class="years_center">		<div id="denied">			<h1 class="denied_title">Доступ к сайту запрещен!</h1>		</div>		<h1 class="title_years">Вам есть 18?</h1>		<a href="javascript:void(0);" id="yes" onclick="years(this,'shadow','links 1');"></a>		<a href="javascript:void(0);" id="no" onclick="years(this,'denied','links 2');"></a>	</div>	</div></div><script type="text/javascript" language="javascript">var shadow = document.getElementById("shadow");var denied = document.getElementById("denied");var yes  = document.getElementById("yes");var no  = document.getElementById("no");function years(src,links) {    if(src.id == "yes") {        shadow.style.display = 'none';		setCookie(links,"1");	} else if(src.id == "no") {		denied.style.display = 'block';		setCookie(links,"2");	}}if (getCookie("shadow")=="1") years(document.getElementById("yes"),"shadow","links 1");if (getCookie("denied")=="2") years(document.getElementById("no"),"denied","links 2");// Установить куки function setCookie(name, value) { 	var valueEscaped = escape(value); 	var expiresDate = new Date(); 	expiresDate.setTime(expiresDate.getTime() + 365 * 24 * 60 * 60 * 1000); // срок - 1 год, но его можно изменить 	var expires = expiresDate.toGMTString(); 	var newCookie = name + "=" + valueEscaped + "; path=/; expires=" + expires; 	if (valueEscaped.length <= 4000) document.cookie = newCookie + ";"; }// Получить куки function getCookie(name) { 	var prefix = name + "="; 	var cookieStartIndex = document.cookie.indexOf(prefix); 	if (cookieStartIndex == -1) return null; 	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length); 	if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length; 	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)); }</script></body></html>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy