加入收藏 | 设为首页 | 会员中心 | RSS
您当前的位置:首页 > 在线教程 > 网络编程

最好的asp对联广告教程

时间:2008-07-01 21:39:06  来源:飞天影像  作者:admin

新建一个对联广告的页dlgg.asp,把其它代码删除掉,把下面代码复制到该页Vxm飞天影像[巴中]


<SCRIPT LANGUAGE="JavaScript"> Vxm飞天影像[巴中]
<!-- Vxm飞天影像[巴中]
var showad = true; Vxm飞天影像[巴中]
var Toppx = 60; //上端位置 Vxm飞天影像[巴中]
var AdDivW = 100; //宽度 Vxm飞天影像[巴中]
var AdDivH = 360; //高度 Vxm飞天影像[巴中]
var PageWidth = 800; //页面多少宽度象素下正好不出现左右滚动条 Vxm飞天影像[巴中]
var MinScreenW = 1024; //显示广告的最小屏幕宽度象素 Vxm飞天影像[巴中]
var ClosebuttonHtml = '<div align="right" style="position: absolute;top:-20px;right:0px;margin:-4.5px;padding:2px;z-index:2000;"><a href="javascript:;" onclick="hidead()" style="color:red;text-decoration:none;font-size:12px;"><img src="images/close.gif"></a></div>' Vxm飞天影像[巴中]
var AdContentHtml = '<a href="http://www.dvbz.cn" target="_blank"><img src="images/ad_100x300.jpg">'; Vxm飞天影像[巴中]
document.write ('<div id="Javascript.LeftDiv" style="position: absolute;border: 1px solid #336699;background-color:#EEEEE2;z-index:1000;width:'+AdDivW+'px;height:'+AdDivH+'px;top:-1000px;word-break:break-all;display:none;">'+ClosebuttonHtml+'<div>'+AdContentHtml+'</div></div>'); Vxm飞天影像[巴中]
document.write ('<div id="Javascript.RightDiv" style="position: absolute;border: 1px solid #336699;background-color:#EEEEE2;z-index:1000;width:'+AdDivW+'px;height:'+AdDivH+'px;top:-1000px;word-break:break-all;display:none;">'+ClosebuttonHtml+'<div>'+AdContentHtml+'</div></div>'); Vxm飞天影像[巴中]
function scall(){ Vxm飞天影像[巴中]
if(!showad){return;} Vxm飞天影像[巴中]
if (window.screen.width<MinScreenW){ Vxm飞天影像[巴中]
alert("临时提示:\n\n显示器分辨率宽度小于"+MinScreenW+",不显示广告"); Vxm飞天影像[巴中]
showad = false; Vxm飞天影像[巴中]
document.getElementById("Javascript.LeftDiv").style.display="none"; Vxm飞天影像[巴中]
document.getElementById("Javascript.RightDiv").style.display="none"; Vxm飞天影像[巴中]
return; Vxm飞天影像[巴中]
} Vxm飞天影像[巴中]
var Borderpx = ((window.screen.width-PageWidth)/2-AdDivW)/2;

document.getElementById("Javascript.LeftDiv").style.display=""; Vxm飞天影像[巴中]
document.getElementById("Javascript.LeftDiv").style.top=document.body.scrollTop+Toppx; Vxm飞天影像[巴中]
document.getElementById("Javascript.LeftDiv").style.left=document.body.scrollLeft+Borderpx; Vxm飞天影像[巴中]
document.getElementById("Javascript.RightDiv").style.display=""; Vxm飞天影像[巴中]
document.getElementById("Javascript.RightDiv").style.top=document.body.scrollTop+Toppx; Vxm飞天影像[巴中]
document.getElementById("Javascript.RightDiv").style.left=document.body.scrollLeft+document.body.clientWidth-document.getElementById("Javascript.RightDiv").offsetWidth-Borderpx; Vxm飞天影像[巴中]
}
Vxm飞天影像[巴中]

function hidead() Vxm飞天影像[巴中]
{ Vxm飞天影像[巴中]
showad = false; Vxm飞天影像[巴中]
document.getElementById("Javascript.LeftDiv").style.display="none"; Vxm飞天影像[巴中]
document.getElementById("Javascript.RightDiv").style.display="none"; Vxm飞天影像[巴中]
} Vxm飞天影像[巴中]
window.onscroll=scall; Vxm飞天影像[巴中]
window.onresize=scall; Vxm飞天影像[巴中]
window.onload=scall; Vxm飞天影像[巴中]
//--> Vxm飞天影像[巴中]
</SCRIPT>
Vxm飞天影像[巴中]


说明:Vxm飞天影像[巴中]

1、可以对-20px  -4.5px  -1000px等参数进行调整,可以对广告的位置进行改变Vxm飞天影像[巴中]

2、images/close.gif是关闭的图片,images/ad_100x300.jpg是内容的图片,这两项都可绑定数据库Vxm飞天影像[巴中]

3、<a href="http://www.dvbz.cn" target="_blank">可以绑定数据库的链接地址Vxm飞天影像[巴中]

4、把该页头部的删除掉Vxm飞天影像[巴中]

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>Vxm飞天影像[巴中]
<!--#include file="Connections/conn.asp" -->
Vxm飞天影像[巴中]

5、在所需的页面点插入--服务器端包括,就搞定了数据库添加对联广告的方法Vxm飞天影像[巴中]

来顶一下
近回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表