【设为首页 图片漂移】代码2007-03-10 22:56【设为首页】
<span strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.cnzz.cc');" style="CURSOR: hand">设为首页</span>
【设为首页】
<span strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('【 e城市 http://www.echengshi.cn】');" style="CURSOR: hand">【设为首页】</span>
【带链接自由移动图片】
<script language="JavaScript">
<!--
if(parseInt(navigator.appVersion.charAt(0))<4){
location.href=" http://www.7wind.com"
}
var mvtLight="image/007s.jpg"
var mvtWidth=140
var mvtHeight=105
var mvtLink=" http://www.7wind.com"
var mvtAlt="中讯数据"
brOK=navigator.javaEnabled()?true:false
ns4=(document.layers)?true:false
ie4=(document.all)?true:false
if(ns4){
document.write('<layer id="mvt" width=40 height=60;"><a href="'+mvtLink+'" target=_blank><img border=0 src="'+mvtLight+'" border=0 width="'+mvtWidth+'" height="'+mvtHeight+'" alt="'+mvtAlt+'"><\/a><\/layer>');
}
else{
document.write('<div id="mvt" style="position:absolute; width:40; height:60;"><a href="'+mvtLink+'" target=_blank><img src="'+mvtLight+'" border=0 width="'+mvtWidth+'" height="'+mvtHeight+'" alt="'+mvtAlt+'"><\/a><\/div>');
}
var vmin=2;
var vmax=5;
var vr=2;
var timer1;
function Chip(chipname,width,height)
{this.named=chipname;
this.vx=vmin+vmax*Math.random();
this.vy=vmin+vmax*Math.random();
this.w=width;
this.h=height;
this.xx=0;
this.yy=0;
this.timer1=null;
}
function movechip(chipname)
{
if(brOK)
{eval("chip="+chipname);
if(ns4)
{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+=vr*(Math.random()-0.5);
chip.vy+=vr*(Math.random()-0.5);
if(chip.vx>(vmax+vmin)) chip.vx=(vmax+vmin)*2-chip.vx;
if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;
if(chip.vy>(vmax+vmin)) chip.vy=(vmax+vmin)*2-chip.vy;
if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;
if(chip.xx<=pageX)
{ chip.xx=pageX;
chip.vx=vmin+vmax*Math.random();
}
if(chip.xx>=pageX+pageW-chip.w)
{ chip.xx=pageX+pageW-chip.w;
chip.vx=-vmin-vmax*Math.random();
}
if(chip.yy<=pageY)
{ chip.yy=pageY;
chip.vy=vmin+vmax*Math.random();
}
if(chip.yy>=pageY+pageH-chip.h)
{ chip.yy=pageY+pageH-chip.h;
chip.vy=-vmin-vmax*Math.random();
}
if(ns4){
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.timer1=setTimeout("movechip('"+chip.named+"')",100);
}
}
function stopme(chipname)
{if(brOK)
{//alert(chipname)
eval("chip="+chipname);
if(chip.timer1!=null)
{clearTimeout(chip.timer1)}
}
}
var mvt;
function mvt()
{
mvt=new Chip("mvt",60,80);
if(brOK){
movechip("mvt");
}
}
window.onload=mvt
//-->
</script>
【左侧上下移动图片】
【左侧上下移动的图片代码提示:将下面的代码复制到〈BODY〉区 】
<div id="point1" STYLE="position:absolute;visibility:visible;">
<table border="0" cellspacing="0" cellpadding="0">
<tr><td><a href="
http://www.hulaoshi.cn"><img src="消费广场贴吧2logo.jpg" alt="" border="0"></a>
</td></tr><tr><td><center><a href=" http://www.hulaoshi.cn">
<font face="Arial" size="2" color="#0000FF">胡老师户老虎</font>
</a></center></td></tr></table>
</div>
<script LANGUAGE="JavaScript1.2">
var XX=20; // X position of the scrolling objects
var xstep=1;
var delay_time=60;
//Begin of the unchangable area, please do not modify this area
var YY=0;
var ch=0;
var oh=0;
var yon=0;
var ns4=document.layers?1:0
var ie=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
if(ie){
YY=document.body.clientHeight;
point1.style.top=YY;
}
else if (ns4){
YY=window.innerHeight;
document.point1.pageY=YY;
document.point1.visibility="hidden";
}
else if (ns6){
YY=window.innerHeight
document.getElementById('point1').style.top=YY
}
function reloc1()
{
if(yon==0){YY=YY-xstep;}
else{YY=YY+xstep;}
if (ie){
ch=document.body.clientHeight;
oh=point1.offsetHeight;
}
else if (ns4){
ch=window.innerHeight;
oh=document.point1.clip.height;
}
else if (ns6){
ch=window.innerHeight
oh=document.getElementById("point1").offsetHeight
}
if(YY<0){yon=1;YY=0;}
if(YY>=(ch-oh)){yon=0;YY=(ch-oh);}
if(ie){
point1.style.left=XX;
point1.style.top=YY+document.body.scrollTop;
}
else if (ns4){
document.point1.pageX=XX;
document.point1.pageY=YY+window.pageYOffset;
}
else if (ns6){
document.getElementById("point1").style.left=XX
document.getElementById("point1").style.top=YY+window.pageYOffset
}
}
function onad()
{
if(ns4)
document.point1.visibility="visible";
loopfunc();
}
function loopfunc()
{
reloc1();
setTimeout('loopfunc()',delay_time);
}
if (ie||ns4||ns6)
window.onload=onad
</script>