搜索
您的当前位置:首页左右两侧的广告代码简单_广告代码

左右两侧的广告代码简单_广告代码

时间:2023-12-01 来源:红星娱乐
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

小编还为您整理了以下内容,可能对您也有帮助:

如何制作网页左右两边的广告代码(可关闭的那种)

分类: 电脑/网络 >> 程序设计 >> 其他编程语言

问题描述:

如何制作网页左右两边的广告代码(可关闭的那种)

左右各两张图片.关闭其中一张则全部关闭.

可跟随上下移动.

解析:

<script language=javascript>

dt3_flash="/ad/swf/yuandan.swf" 左边flash

dt4_flash="/ad/swf/yuandan.swf" 右边

dt3_img="/ggao/gif/hezuo.gif" 左边图片

dt4_img="/ggao/gif/hezuo.gif" 右边

dl_click="indexx" 点击后连接地址

function ilianload()

{

sidebar3.style.top=50; 离顶部距离

sidebar3.style.left=5; 离左边距离

sidebar4.style.top=50;

sidebar4.style.right=5; 右边距离

}

function MoveLayer(layerName)

{

var y = 50;浮动广告层固定于浏览器的y方向位置

var diff = (document.body.scrollTop + y - eval("document.all." + layerName + ".style.posTop"))*0.93;

var y = document.body.scrollTop + y - diff;

eval("document.all." + layerName + ".style.posTop = y");

setTimeout("MoveLayer('"+layerName+"');", 20);设置20毫秒后再调用函数MoveLayer()

}

if(document.all && window.screen.width>800)

{

flash对联

document.write("<div id=sidebar3 style='position: absolute;visibility:visible;z-index:1'><EMBED src='"+dt3_flash+"' quality=high WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=ilianid wmode=transparent></EMBED></div>"+"<div id=sidebar4 style='position: absolute;visibility:visible;z-index:1'><EMBED src='"+dt4_flash+"' quality=high WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=ilianid wmode=transparent></EMBED></div>");

图片对联

document.write("<div id=sidebar3 style='position: absolute;visibility:visible;z-index:1'><a href='/ggao/hezuo' target='_blank'><img src='"+dt3_img+"' border=0></a></div>"+"<div id=sidebar4 style='position: absolute;visibility:visible;z-index:1'><a href='/ggao/hezuo' target='_blank'><img src='"+dt4_img+"' border=0></a></div>");

ilianload();

MoveLayer('sidebar3');

MoveLayer('sidebar4');

}

function ilian_DoFSCommand(mand,args)

{

if (mand == "Close")

{

if (args=="left"){

document.all.sidebar3.style.visibility = "hidden";

}

else if (args=="right"){

document.all.sidebar4.style.visibility = "hidden";

}

else{

document.all.sidebar3.style.visibility = "hidden";

document.all.sidebar4.style.visibility = "hidden";

}

}

if (mand == "GoUrl"){

window.open(dl_click);

}

}

if (document.all){

document.write("<Script language=\"JavaScript\" For=\"ilianid\" Event=\"FSCommand(mand,args)\">\n");

document.write(" ilian_DoFSCommand(mand,args);\n");

document.write("</Scri"+"pt>\n");

}

</script>

修改为自己的就可以了!

如何制作网页左右两边的广告代码(可关闭的那种

用以下代码即可:

function$(id){

returndocument.(id);

}

function(timer,moveNumber){

functionmove(o){

varst=document..scrollTopo.t;

varsl=document..scrollLeft(o.c==0?o.a:document..clientWidth-o.a-o.offsetWidth);

vartc=st-o.offsetTop,lc=sl-o.offsetLeft;

with(o.style){

top=o.offsetTop(tc!=0?tc/Math.abs(tc):0)*Math.min(Math.abs(tc),moveNumber)"px";

left=o.offsetLeft(lc!=0?lc/Math.abs(lc):0)*Math.min(Math.abs(lc),moveNumber)"px";

}

if(o.person){

with(o.person.style){

top=o.offsetTop"px";

left=o.offsetLefto.offsetWidth-o.person.offsetWidth"px";

}

}

}

varhidden=function(){

varo=this.parent;

window.(o.interval);

o.parentNode.removeChild(o);

this.parentNode.removeChild(this);

}

this.add=function(to,t,a,c,lo){

/*

to为object对象

t为距离顶端距离

当c=0的时候,a为距离左边的距离

当c!=0的时候,a为距离右边的距离

lo为关闭按钮

*/

vardiv,exec=function(){

move(to);

};

to.person=lo;

to.t=t;

to.a=a;

to.c=c;

with(to.style){

position="absolute";

display="block";

top=document..scrollTopt;

left=document..scrollLeft(c==0?a:document..clientWidth-a-to.offsetWidth);

}

if("undefined"!=typeoflo){

with(lo.style){

position="absolute";

display="block";

}

lo.onmousedown=hidden;

lo.parent=to;

}

exec();

to.interval=window.setInterval(exec,timer);

};

}

window.onload=function(){

varb=new(10,15);

b.add($("lwc"),80,10,0,$("lwc_c"));

b.add($("rwc"),80,10,1,$("rwc_c"));

b=null;

}

如何制作网页左右两边的广告代码(可关闭的那种)

<script language=javascript>

dt3_flash="/ad/swf/yuandan.swf" //左边flash

dt4_flash="/ad/swf/yuandan.swf" //右边

dt3_img="/ggao/gif/hezuo.gif" //左边图片

dt4_img="/ggao/gif/hezuo.gif" //右边

dl_click="index.aspx" //点击后连接地址

function ilianload()

{

sidebar3.style.top=50; //离顶部距离

sidebar3.style.left=5; //离左边距离

sidebar4.style.top=50;

sidebar4.style.right=5; //右边距离

}

function MoveLayer(layerName)

{

var y = 50;//浮动广告层固定于浏览器的y方向位置

var diff = (document.body.scrollTop + y - eval("document.all." + layerName + ".style.posTop"))*0.93;

var y = document.body.scrollTop + y - diff;

eval("document.all." + layerName + ".style.posTop = y");

setTimeout("MoveLayer('"+layerName+"');", 20);//设置20毫秒后再调用函数MoveLayer()

}

if(document.all && window.screen.width>800)

{

//flash对联

//document.write("<div id=sidebar3 style='position: absolute;visibility:visible;z-index:1'><EMBED src='"+dt3_flash+"' quality=high WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=ilianid wmode=transparent></EMBED></div>"+"<div id=sidebar4 style='position: absolute;visibility:visible;z-index:1'><EMBED src='"+dt4_flash+"' quality=high WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=ilianid wmode=transparent></EMBED></div>");

//图片对联

document.write("<div id=sidebar3 style='position: absolute;visibility:visible;z-index:1'><a href='/ggao/hezuo.html' target='_blank'><img src='"+dt3_img+"' border=0></a></div>"+"<div id=sidebar4 style='position: absolute;visibility:visible;z-index:1'><a href='/ggao/hezuo.html' target='_blank'><img src='"+dt4_img+"' border=0></a></div>");

ilianload();

MoveLayer('sidebar3');

MoveLayer('sidebar4');

}

function ilian_DoFSCommand(command,args)

{

if (command == "Close")

{

if (args=="left"){

document.all.sidebar3.style.visibility = "hidden";

}

else if (args=="right"){

document.all.sidebar4.style.visibility = "hidden";

}

else{

document.all.sidebar3.style.visibility = "hidden";

document.all.sidebar4.style.visibility = "hidden";

}

}

if (command == "GoUrl"){

window.open(dl_click);

}

}

if (document.all){

document.write("<Script language=\"JavaScript\" For=\"ilianid\" Event=\"FSCommand(command,args)\">\n");

document.write(" ilian_DoFSCommand(command,args);\n");

document.write("</Scri"+"pt>\n");

}

</script>

修改为自己的就可以了!

网页左右随滚动条滚动的广告代码

<script>

var

speed=40;//滚动速度

var

AdLayer1="dd1";//左侧div的ID

var

AdLayer2="dd2";//右侧div的ID

function

initEcAd()

{

document.getElementById(AdLayer1).style.posTop

=

-200;

document.getElementById(AdLayer1).style.visibility

=

'visible'

document.getElementById(AdLayer2).style.posTop

=

-200;

document.getElementById(AdLayer2).style.visibility

=

'visible'

MoveLeftLayer(AdLayer1);

MoveRightLayer(AdLayer2);

}

function

MoveLeftLayer(layerName)

{

var

x

=

5;//左侧广告maring-left值

var

y

=

100;//

左侧广告距离页首高度

var

diff

=

(document.body.scrollTop

+

y

-

document.getElementById(AdLayer1).style.posTop)*.40;

var

y

=

document.body.scrollTop

+

y

-

diff;

eval("document.getElementById('"

+

layerName

+"').style.posTop

=

parseInt(y)");

eval("document.getElementById('"

+

layerName

+

"').style.posLeft

=

x");

setTimeout("MoveLeftLayer(AdLayer1);",

speed);

}

function

MoveRightLayer(layerName)

{

var

x

=

5;

var

y

=

100;//

右侧广告距离页首高度

var

diff

=

(document.body.scrollTop

+

y

-

document.getElementById(AdLayer2).style.posTop)*.40;

var

y

=

document.body.scrollTop

+

y

-

diff;

eval("document.getElementById('"

+

layerName

+

"').style.posTop

=

y");

eval("document.getElementById('"

+

layerName

+

"').style.posRight

=

x");

setTimeout("MoveRightLayer(AdLayer2);",

speed);

}

</script>

<body

onload="initEcAd()">

<div

id=dd1

style="position:

absolute;visibility:hidden;z-index:1;

border:1px

solid

red;

height:200px;

width:100px"></div>

<div

id=dd2

style="position:

absolute;visibility:hidden;z-index:1;

border:1px

solid

red;

height:200px;

width:100px"></div>

<div

style="height:2000px"></div>

</body>

<script>

</script>

红星娱乐还为您提供以下相关内容希望对您有帮助:

如何制作网页左右两边的广告代码(可关闭的那种

用以下代码即可:function$(id){ returndocument.(id);} function(timer,moveNumber){ functionmove(o){ varst=document..scrollTopo.t;varsl=document..scrollLeft(o.c==0?o.a:document..clientWidth-o.a-o.offsetW...

两侧广告,和网站背景颜色图片,代码是如何设置的

两侧广告用position:absolute;left ,right来控制,建立2个div,然后用var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;来判断滚动条的位置,还有关闭比较好做,...

如何制作网页左右两边的广告代码(可关闭的那种)

dt3_flash="/ad/swf/yuandan.swf" //左边flash dt4_flash="/ad/swf/yuandan.swf" //右边 dt3_img="/ggao/gif/hezuo.gif" //左边图片 dt4_img="/ggao/gif/hezuo.gif" //右边 dl_click="in...

HTMl教程:实现网页左右两侧居中的对联广告代码

&lt;!DOCTYPE html&gt; Document {margin: 0;padding: 0;} .Ad{ position: fixed;width: 140px;height: 500px;background: #db3e52 ;top: -moz-calc(50% - 250px);top: -webkit-calc(50% - 250px);top: c...

网站两侧浮动广告代码插入竖条FLASH广告的代码?

&lt;!--两侧浮动flash广告代码结束--&gt; 把上面这段程序的以下代码换成你的flash地址即可。http://goto.sohu.com/goto.php3?code=youpai-sh47-frduilian&gt; &lt;PARAM NAME=quality VALUE=high&gt;&lt;PARAM NAME=wmode VALUE=...

...程序网站首页左右两边可以上下浮动广告代码?代码最好可以短一点...

广告代码 浮动的很多 1、在网页中加入 表示调用当前目录下的js目录下的1.js 2、用记事本建立1.js 并保存到js目录下 并把后缀名从txt改名为js 1.js内容如下 var delta=0.15 var collection;function floaters() {...

求网站左右空白地方悬浮对联广告代码,可以上下移动的那种

先在你的网站主目录建立JS文件,再建立一个JS文件(如ad-01.js)打开文本将下面代码复制到其中,保存格式为js function initEcAd() { document.all.AdLayer1.style.posTop = -200;document.all.AdLayer1.style.visibility...

CSS 网页两边的悬浮广告 谁有制作代码,最好是,源文件!谢谢!!!可追加悬...

悬浮广告

求一个随网页两边漂浮的广告的js代码

this.items = [];this.addItem = function(id,x,y,content){ document.write('&lt;DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x...

怎么写带关闭的网页广告对联代码,是网页两侧的那种?

} function scrollBanner(timer, moveNumber) { function move(o) { var st = document.documentElement.scrollTop + o.t;var sl = document.documentElement.scrollLeft + (...

Top