如何在网页左右两边插入跟随鼠标滚动的广告栏,最好是有相应的代码,加急啊!!!!

 我来答
kAO14rR
2014-06-23 · TA获得超过236个赞
知道答主
回答量:119
采纳率:50%
帮助的人:133万
展开全部
<html> <head> <title>网页特效---对联广告</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body style="margin:0px;"> <SCRIPT LANGUAGE="JavaScript"> <!-- var showad = true; var Toppx = 60; //上端位置 var AdDivW = 100; //宽度 var AdDivH = 360; //高度 var PageWidth = 800; //页面多少宽度象素下正好不出现左右滚动条 var MinScreenW = 1024; //显示广告的最小屏幕宽度象素 var ClosebuttonHtml = '<div align="right" style="position: absolute;top:0px;right:0px;margin:2px;padding:2px;z-index:2000;"><a href="javascript:;" onclick="hidead()" style="color:red;text-decoration:none;font-size:12px;">关闭</a></div>' var AdContentHtml = '<div align="center" style="color:green;font-size:23pt;font-family:黑体;"><br>这<br>是<br>广<br>告<br>内<br>容</div>'; 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>'); 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>'); function scall(){ if(!showad){return;} if (window.screen.width<MinScreenW){ alert("临时提示:\n\n显示器分辨率宽度小于"+MinScreenW+",不显示广告"); showad = false; document.getElementById("Javascript.LeftDiv").style.display="none"; document.getElementById("Javascript.RightDiv").style.display="none"; return; } var Borderpx = ((window.screen.width-PageWidth)/2-AdDivW)/2; document.getElementById("Javascript.LeftDiv").style.display=""; document.getElementById("Javascript.LeftDiv").style.top=document.body.scrollTop+Toppx; document.getElementById("Javascript.LeftDiv").style.left=document.body.scrollLeft+Borderpx; document.getElementById("Javascript.RightDiv").style.display=""; document.getElementById("Javascript.RightDiv").style.top=document.body.scrollTop+Toppx; document.getElementById("Javascript.RightDiv").style.left=document.body.scrollLeft+document.body.clientWidth-document.getElementById("Javascript.RightDiv").offsetWidth-Borderpx; } function hidead() { showad = false; document.getElementById("Javascript.LeftDiv").style.display="none"; document.getElementById("Javascript.RightDiv").style.display="none"; } window.onscroll=scall; window.onresize=scall; window.onload=scall; //--> </SCRIPT> <p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p><p>1111111</p> </body> </html> // 使用方法:将一上代码保存为 .html 的文档即可浏览。
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式