半点优化网 http://www.bdxc.net/
当前位置首页 > 网站技术问题> 正文

网页制作中,怎么套用其他页面的头部和尾部啊?直接复制代码还是什么呢?

2022-05-29 21:39:39 暂无评论 89 网站技术问题 底部   始终   处于

可以直接复制相应代码过来,也可以采用调用的办法,如<!--#include file=bottom.asp-->是在调用底部文件

那你可以做成模版,然后用到的页面套用下,很方便的唉!!!

div 块始终处于网页最底部的代码

你这个是要漂浮广告的代码了<!-------------------------------------------文件名:23.2.htm--------------------------------><html><head><title>随页面滚动的对联广告</title><meta http-equiv=Content-Type content=text/html; charset=gb2312></head><body><center><h1>随页面滚动的对联广告</h1><hr></center><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p><script language=JavaScript><!--var delta=0.8;var collection;var closeB=false;function floaters(){this.items= [];this.addItem= function(id,x,y,content){ //向页面写入一个<div>document.write('<DIV id='+id);document.write(' style=Z-INDEX: 10; POSITION: absolute;width:80px; height:60px;');document.write('left:'+(typeof(x)=='string'?eval(x):x));document.write(';top:'+(typeof(y)=='string'?eval(y):y)+'>');document.write(content+'</DIV>');var newItem= {};//获取元素属性newItem.object= document.getElementById(id);newItem.x= x; //设置横坐标newItem.y= y; //设置纵坐标this.items[this.items.length]= newItem;}this.play= function(){collection= this.items;setInterval('play()',30); //调用函数play()}}function play(){if(screen.width<=800 || closeB){for(var i=0;i<collection.length;i++){ //设置显隐属性collection[i].object.style.display= 'none';}return;}for(var i=0;i<collection.length;i++){var followObj= collection[i].object;var followObj_x= (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);var followObj_y= (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);//设置左边位置if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)){var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));followObj.style.left=followObj.offsetLeft+dx;}//设置顶部位置if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)){var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));followObj.style.top=followObj.offsetTop+dy;}followObj.style.display= '';}}function closeBanner() //函数:关闭{closeB=true;return;}var theFloaters= new floaters();//添加广告图像theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,'<img src=ad-01.gif alt=广告内容二><br><br><img src=close.gif onClick=closeBanner();>');theFloaters.addItem('followDiv2',6,80,'<img src=ad-01.gif alt=广告内容一><br><br><img src=close.gif onClick=closeBanner();>');theFloaters.play();//页面其他内容显示输出for(var i=0;i<20;i++){document.write(<center>这里是页面内容!</center>);}//--></script></p></body></html>自己修改一下

css:#ddd{position:fixed;bottom:0;right:0;}如上:将会一直在右下角

猜你喜欢