当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 对联广告js flash激活

Javascript
符合标准的对联广告
Firefox 无法获取cssRules 的解决办法
简单JS代码压缩器
不错的asp中显示新闻的功能
动态加载js文件 document.createElement
[原创]静态页面也可以实现预览 列表不同的显示方式
JS代码格式化和语法着色V2
关于javascript的“静态类"
显示/隐藏侧边栏
网页取色
cancelBubble阻止事件冒泡
屏蔽alt+f4代码,一个变通的方法
光标的一些操作总结
使用TextRange获取输入框中光标的位
Using the TextRange Object
textbox右键菜单
document.createRange实例
模仿IE自动完成功能
计算100000数组js脚本的执行时间
怎么让脚本或里面的函数在所有图片都载入完毕的时候执行

Javascript 中的 对联广告js flash激活


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 49 ::
收藏到网摘: n/a

ad.js

复制代码 代码如下:

var delta=0.08
var collection;
function floaters() {
this.items = [];
this.addItem = function(id,x,y,content)
{
document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+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()',10);
}
}
function play()
{
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 = '';
}
}
var theFloaters = new floaters();
//右面
theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,'<EMBED src=images/duilian.swf quality=high WIDTH=100 HEIGHT=300 TYPE=application/x-shockwave-flash id=ad wmode=opaque></EMBED>');
//左面
theFloaters.addItem('followDiv2',6,80,'<EMBED src=images/duilian.swf quality=high WIDTH=100 HEIGHT=300 TYPE=application/x-shockwave-flash id=ad wmode=opaque></EMBED>');
theFloaters.play();
//图片格式调用方法
//<a href=http://www.makewing.com/lanren/ target=_blank><img src=images/ad_100x300.jpg border=0></a>