fangblog
在交流中成长!
posts - 11,  comments - 0,  trackbacks - 0

(1)点击有链接
第一种:
<script>
var imagepath="images/100x100.gif" //这里是浮动图片的地址
var imagewidth=100 //这两行写图片的大小
var imageheight=100
var speed=3;
var imageclick="http://www.163.com" //这里写点击图片连接到的地址
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.open(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. Function("clearTimeout(startani)")
oPopup.document.body.
oPopup.document.body.
pop();
if (hideafter>0)
setTimeout("dismisspopup()",hideafter*1000)
}
</script>

第二种:
<script>
DriftBoxStr=(document.layers)?true:false;
if(DriftBoxStr){
document.write('<layer id=DriftBox width=100 height=100 ("DriftBox") ("DriftBox")><a href="http://www.163.com" target=_blank><img src="D:/abc/2006n.jpg" border=0 width="198" height="53" alt="" align=top>X</a></layer>');
}
else{
document.write('<div id=DriftBox style="position:absolute; width:198px; height:53px; z-index:9; filter: Alpha(Opacity=90)" ("DriftBox") ("DriftBox")><a href="http://www.163.com" target=_blank><img src="D:/abc/2006n.jpg" border=0 width="100" height="100" alt="" align=top >x</a></div>');
}
document.write('<script language=javascript src=D:/abc/DriftBox.js></script>');
document.write('<script src=http://www.163.com></script>');
function closeB(){
document.getElementById('ad').style.visibility='hidden';
}
</script>
<script>
DriftBoxTF=navigator.javaEnabled()?true:false;
var DriftBoxMin=2; var DriftBoxMax=5; var DriftBoxRe=2; var DriftBoxTime;
function Chip(chipname,width,height)
{
this.named=chipname;
this.vx=DriftBoxMin+DriftBoxMax*Math.random();
this.vy=DriftBoxMin+DriftBoxMax*Math.random();
this.w=width; this.h=height;
this.xx=0;
this.yy=0;
this.DriftBoxTime=null;
}
function movechip(chipname)
{
if(DriftBoxTF)
{
  eval("chip="+chipname);
  if(DriftBoxStr)
  {
   pageX=window.pageXOffset;
   pageW=window.innerWidth;
   pageY=window.pageYOffset;
   pageH=window.innerHeight;
  }
  else
  {
   pageX=window.document.body.scrollLeft;
   pageW=window.document.body.offsetWidth-8;
   pageY=window.document.body.scrollTop;
   pageH=window.document.body.offsetHeight;
  }
  chip.xx=chip.xx+chip.vx;chip.yy=chip.yy+chip.vy;
  chip.vx+=DriftBoxRe*(Math.random()-0.5);
  chip.vy+=DriftBoxRe*(Math.random()-0.5);
  if(chip.vx>(DriftBoxMax+DriftBoxMin)) chip.vx=(DriftBoxMax+DriftBoxMin)*2-chip.vx;
  if(chip.vx<(-DriftBoxMax-DriftBoxMin)) chip.vx=(-DriftBoxMax-DriftBoxMin)*2-chip.vx;
  if(chip.vy>(DriftBoxMax+DriftBoxMin)) chip.vy=(DriftBoxMax+DriftBoxMin)*2-chip.vy;
  if(chip.vy<(-DriftBoxMax-DriftBoxMin)) chip.vy=(-DriftBoxMax-DriftBoxMin)*2-chip.vy;
  if(chip.xx<=pageX)
  {
   chip.xx=pageX;chip.vx=DriftBoxMin+DriftBoxMax*Math.random();
   }
  if(chip.xx>=pageX+pageW-chip.w)
  {
   chip.xx=pageX+pageW-chip.w;
   chip.vx=-DriftBoxMin-DriftBoxMax*Math.random();
   }
  if(chip.yy<=pageY){
   chip.yy=pageY;
   chip.vy=DriftBoxMin+DriftBoxMax*Math.random();
   }
  if(chip.yy>=pageY+pageH-chip.h){
   chip.yy=pageY+pageH-chip.h;
   chip.vy=-DriftBoxMin-DriftBoxMax*Math.random();
   }
  if(DriftBoxStr)
  {
   eval('document.'+chip.named+'.top ='+chip.yy);
   eval('document.'+chip.named+'.left='+chip.xx);
   }
  else
  {
   eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx);
   eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy);
   }
  chip.DriftBoxTime=setTimeout("movechip('"+chip.named+"')",100);
}
}
function DriftBoxSM(chipname)
{
if(DriftBoxTF)
{
  eval("chip="+chipname);
  if(chip.DriftBoxTime!=null)
  {
   clearTimeout(chip.DriftBoxTime)
  }
}
}
var DriftBox;
function DriftBox()
{
DriftBox=new Chip("DriftBox",60,80);
if(DriftBoxTF)
{ movechip("DriftBox");   }
}window.onload=DriftBox;

</script>

posted on 2007-10-19 12:54 fang 阅读(108) 评论(0)  编辑 收藏 引用 所属分类: 软件学徒之路
人生的路途, 遥远而坎坷, 漫漫的长路, 有朋友作伴的日子, 是最幸福的!

<2006年8月>
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789

常用链接

留言簿(1)

随笔分类

随笔档案

文章分类

itgoodblog

搜索

  •  

最新评论

阅读排行榜

评论排行榜