Тема: popunder
Показать сообщение отдельно

  #2  
Старый 20.11.2008, 16:47
.:EnoT:.
Постоянный
Регистрация: 29.05.2007
Сообщений: 852
Провел на форуме:
4832771

Репутация: 1916


По умолчанию

JS:

Код:
var ver = navigator.appVersion;

if (ver.indexOf('MSIE') != -1){
	document.write("<link rel='stylesheet' href='<?=$servname;?>pop_style.css' type='text/css' /><div id='PopWin' style='top:250px;'>"
	+" <table width='468' height='80' cellspacing='0' cellpadding='0' style='border: 2px double black; background-color: #666666;'>"
	+" <tr height='20'><td bgcolor='#666666' width='238' style='padding-left: 10px; background-color: #666666;'><b>"
	+" <a target='_blank' style='font-size: 14px; color: #00CC00; "
	+" font-family: Arial; text-decoration:none; font-style:italic;' href='<?=$servname;?>'>"
	+" <?=$popname;?></a></td>"
	+" <td bgcolor='#666666' width='230' style='padding-right: 3px; background-color: #666666;' align='right'>"
	+" <b><a style='font-size: 13px; color: #FFFFFF;  font-family: Arial; text-decoration:none;'"
	+" onclick='DivOff()' title='Close' href='javascript: PopShow()'>Close[X]</a></b></td></tr>"
	+" <tr><td height='60' width='468' colspan='2' bgcolor='#CCCCCC'>"
	+" <center><?=$show_ban;?></center></tr>"
	+" </tr></table></div>");
	if (document.all['PopWin'].style)
	window.setInterval("MovePop()", 5);
	window.onerror=null;
	document.body.scrollTop=10; 
	
}else{
	
	document.write("<link rel='stylesheet' href='<?=$servname;?>pop_style.css' type='text/css' /><div id='PopWin' style='position:fixed; top:44%;'>");
	document.write(" <table width='468' height='80' cellspacing='0' cellpadding='0' style='border: 2px double black; background-color: #666666;'>"
	+" <tr height='20'><td bgcolor='#666666' width='238' style='padding-left: 10px; background-color: #666666;'><b>"
	+" <a target='_blank' style='font-size: 14px; color: #00CC00; "
	+" font-family: Arial; text-decoration:none; font-style:italic;' href='<?=$popname;?>'>"
	+" <?=$popname;?></a></td>"
	+" <td bgcolor='#666666' width='230' style='padding-right: 3px; background-color: #666666;' align='right'>"
	+" <b><a style='font-size: 13px; color: #FFFFFF;  font-family: Arial; text-decoration:none;'"
	+" onclick='DivOff()' title='Close' href='javascript: PopShow()'>Close[X]</a></b></td></tr>"
	+" <tr><td height='60' width='468' colspan='2' bgcolor='#CCCCCC'>"
	+" <center><?=$show_ban;?></center></tr>"
	+" </tr></table></div>");
}

function DivOff(){
	document.getElementById('PopWin').style.display='none';
}

function PopShow(){
	window.open("javascript:location.href='<?=$rediect;?>","PopWin","width=640,height=480,resizable=1,toolbar=1,location=1,menubar=1,status=1,scrollbars=1");
	window.focus();
	DivOff();
}

function MovePop(){
	if (document.body.scrollTop==0)
	document.all['PopWin'].style.top=document.documentElement.scrollTop+250; else
	document.all['PopWin'].style.top=document.body.scrollTop+250;
}
Всё это засовываем в php файл и вписываем переменные:
$servname - полный путь к скрипту (http://site.ru/)
$popname - Имя сайта (используется как ссылка в окне)
$show_ban - собственно код баннера
$rediect - куда переадресовываем


и ко всему этому добавляем файл css:

Код:
#PopWin{
background: #000;
width: 470px; height: 90px;
position: absolute;
left: 30%; top: 150px;
cursor: hand;
}
#PopWin P {
margin: 0px; padding: 10px; font-family: verdana, arial, helvetica;
}
#PopWin H1 {
margin: 0px; padding: 10px; text-align:center; font-family: verdana, arial, helvetica;
}
#PopWin A.1 {
color: white; text-decoration: none; font-family: verdana, arial, helvetica; font-size: 30px;
}

#PopTit {
background: #666;
padding: 5px;
font-weight: bold;
text-align: right;
font-family: verdana, arial, helvetica;
cursor: default;
left: 350px;
}
#PopTit A {
color: white; text-decoration: none
}

#LinkDiv {
position: absolute;
width: 350px; height: 18px;
background: #666;
padding: 5px;
font-weight: bold;
text-align: left;
font-family: verdana, arial, helvetica;
cursor: default;
}
#LinkDiv A {
color: #27B127; text-decoration: none
}
Должно работать)


да чуть не забыл, вызов делаем как js:
Код:
<script type="text/javascript" src="http://путь к скрипту.php"></script>

Последний раз редактировалось .:EnoT:.; 20.11.2008 в 16:49..