duilian.asp
上传用户:qyswxdl
上传日期:2013-06-01
资源大小:1373k
文件大小:2k
源码类别:

家庭/个人应用

开发平台:

ASP/ASPX

  1. <%@ Language=VBScript%>
  2. var delta=0.15
  3. var collection;
  4. function floaters() {
  5. this.items = [];
  6. this.addItem = function(id,x,y,content)
  7.   {
  8. 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>');
  9. var newItem = {};
  10. newItem.object = document.getElementById(id);
  11. newItem.x = x;
  12. newItem.y = y;
  13. this.items[this.items.length] = newItem;
  14.   }
  15. this.play = function()
  16.   {
  17. collection = this.items
  18. setInterval('play()',10);
  19.   }
  20. }
  21. function play()
  22. {
  23. if(screen.width<=800)
  24. {
  25. for(var i=0;i<collection.length;i++)
  26. {
  27. collection[i].object.style.display = 'none';
  28. }
  29. return;
  30. }
  31. for(var i=0;i<collection.length;i++)
  32. {
  33. var followObj = collection[i].object;
  34. var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
  35. var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
  36. if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
  37. var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
  38. dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
  39. followObj.style.left=followObj.offsetLeft+dx;
  40. }
  41. if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
  42. var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
  43. dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
  44. followObj.style.top=followObj.offsetTop+dy;
  45. }
  46. followObj.style.display = '';
  47. }
  48. }
  49. var theFloaters = new floaters();
  50. theFloaters.addItem('followDiv1','document.body.clientWidth-92',40,'<a href=http://www.1000n.com/ target=_blank><img src=http://www.1000n.com/ad/duilian.gif  border=0> </a>');
  51. theFloaters.addItem('followDiv2',6,40,'<a href=http://www.1000n.com/ target=_blank><img src=http://www.1000n.com/ad/duilian.gif border=0></a>');
  52. theFloaters.play();