主题:  如何制作游动广告?

痞子鱼

职务:普通成员
等级:1
金币:0.0
发贴:14
注册:2003/11/25 17:50:38
#12004/7/2 22:49:53
门户网站常看到的那种,无论滚动条怎么拉上拉下,广告始终在显示区域游动。



whirlwind

职务:普通成员
等级:1
金币:0.0
发贴:94
注册:2004/3/14 15:02:06
#22004/7/4 0:27:30
跨浏览器的漂浮广告

<SCRIPT LANGUAGE="javascript1.2">
<!--
var imagepath="19.gif"
var imagewidth=32
var imageheight=32
var speed=4;
var imageclick="http://www.maxpages.com/xxl"
var hideafter=0

var isie=0;
if(window.navigator.appName=="Microsoft Internet Explorer"&&window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE"+5,window.navigator.appVersion.indexOf("MSIE"+8)>=5.5) {
isie=1;
}
else {
isie=0;
}

if(isie){
var preloadit=new Image()
preloadit.src=imagepath
}


function pop() {
if(isie) {
x=x+dx;y=y+dy;
oPopup.show(x, y, imagewidth, imageheight);
if(x+imagewidth+5>screen.width) dx=-dx;
if(y+imageheight+5>screen.height) dy=-dy;
if(x<0) dx=-dx;
if(y<0) dy=-dy;
startani=setTimeout("pop();",50);
}
}

function dismisspopup(){
clearTimeout(startani)
oPopup.hide()
}

function dowhat(){
if (imageclick=="dismiss"
dismisspopup()
else
window.location=imageclick
}


if(isie) {
var x=0,y=0,dx=speed,dy=speed;
var oPopup = window.createPopup();
var oPopupBody = oPopup.document.body;
oPopupBody.style.cursor="hand"
oPopupBody.innerHTML = '<IMG SRC="'+preloadit.src+'">';
oPopup.document.body.onmouseover=new Function("clearTimeout(startani)"
oPopup.document.body.onmouseout=pop
oPopup.document.body.onclick=dowhat
pop();

if (hideafter>0)
setTimeout("dismisspopup()",hideafter*1000)
}
-->
</SCRIPT>



x_wolf

职务:普通成员
等级:1
金币:18.0
发贴:4242
注册:2004/8/1 16:08:24
#32004/7/4 11:16:41
始终居于右上,调节第二行的RIGHT、TOP的值控制位置

<SCRIPT>
suspendcode="<DIV id=ad style='right:13px;POSITION:absolute;TOP:1px;'>
<a href='' title=''><img border=0 src=''></a></div>"
document.write(suspendcode);
lastScrollY=0;
function heartBeat(){
diffY=document.body.scrollTop;
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.all.yuzi.style.pixelTop+=percent;
lastScrollY=lastScrollY+percent;}
window.setInterval("heartBeat()",1);
</script>



x_wolf

职务:普通成员
等级:1
金币:18.0
发贴:4242
注册:2004/8/1 16:08:24
#42004/7/4 11:19:19
网页中飘动广告

<div id="img" style="position:absolute;">
<a href="http://www.gy123.com.cn/guer/index.asp" target="_blank">
<img src="IMAGE/1.gif" border="0"></a>
</div>

<SCRIPT LANGUAGE="javascript"><!--
var xPos = 20;
var yPos = document.body.clientHeight;
var step = 1;
var delay = 30;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
img.style.top = yPos;
function changePos() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
img.style.left = xPos + document.body.scrollLeft;
img.style.top = yPos + document.body.scrollTop;
if (yon) {
yPos = yPos + step;
}
else {
yPos = yPos - step;
}
if (yPos < 0) {
yon = 1;
yPos = 0;
}
if (yPos >= (height - Hoffset)) {
yon = 0;
yPos = (height - Hoffset);
}
if (xon) {
xPos = xPos + step;
}
else {
xPos = xPos - step;
}
if (xPos < 0) {
xon = 1;
xPos = 0;
}
if (xPos >= (width - Woffset)) {
xon = 0;
xPos = (width - Woffset);
}
}
function www_gy123_com() {
img.visibility = "visible";
interval = setInterval('changePos()', delay);
}
www_gy123_com();--></script>