分享
 
 
 

当你指向某个链接时,网页中的小球会自动跑过去

王朝html/css/js·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

有什么问题请到<a href='/bbs/forums.php?fid=21'>论坛</a>中发表<br>

<!-- http://www.webjx.com -->

<!-- bbs http://www.webjx.com/bbs-->

<!--把如下代码加入到<head>区域中.注意:图片自选-->

<style type="text/css">

#divCircle {position:absolute; width:10px; height:100px; z-index:1; top:-50px;}

.clButtons {position:absolute; width:50px; height:10px; top:20px;left:100px; visibility:hidden; z-index:10; font-family:新細明體; font-size:10pt;}

.clButtons a { COLOR:#000080; }

</style>

<script language="JavaScript" type="text/javascript">

function lib_bwcheck(){ //Browsercheck (needed)

this.ver=navigator.appVersion

this.agent=navigator.userAgent

this.dom=document.getElementById?1:0

this.opera5=this.agent.indexOf("Opera 5")>-1

this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;

this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;

this.ie4=(document.all && !this.dom && !this.opera5)?1:0;

this.ie=this.ie4||this.ie5||this.ie6

this.mac=this.agent.indexOf("Mac")>-1

this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;

this.ns4=(document.layers && !this.dom)?1:0;

this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)

return this

}

var bw=new lib_bwcheck()

numItems = 4

circleXstart = 10

circleYstart = -25

circleXoffset = 5

circleYoffset = -3

circlePXspeed = 5

circleTspeed = 10

circleStay = 1

function makeObj(obj,nest,x,y){

nest = (!nest)?"":'document.'+nest+'.'

this.css = bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0

this.evnt = bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?this.css:0

this.showIt = b_showIt

this.moveIt = b_moveIt

this.slide = b_slide

this.slideIt = b_slideIt

this.obj = obj+"Object"

eval(this.obj+"=this")

return this

}

var px = bw.ns4||window.opera?"":"px";

function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x+px; this.css.top=this.y+px;}

function b_showIt(){this.css.visibility="visible"}

function b_slideIt(endx,endy,inc,speed,fn,wh) {

if (!this.slideactive) {

var distx = endx - this.x

var disty = endy - this.y

var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/inc

var dx = distx/num

var dy = disty/num

this.slideactive = 1

this.slide(dx,dy,endx,endy,speed,fn,wh)

}

}

function b_slide(dx,dy,endx,endy,speed,fn,wh) {

if (!fn) fn = null

if (!wh) wh = null

if (this.slideactive && (Math.floor(Math.abs(dx))<Math.floor(Math.abs(endx-this.x)) || Math.floor(Math.abs(dy))<Math.floor(Math.abs(endy-this.y)))) {

this.moveIt(this.x+dx,this.y+dy)

eval(wh)

slidTim = setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+speed+",'"+fn+"','"+wh+"')",speed)

}

else{

this.slideactive = 0

this.moveIt(endx,endy)

eval(fn)

}

}

function slideballInit(){

oBut = new Array()

for (var i=0; i<=numItems; i++){

oBut[i] = new makeObj('divButton'+i)

}

oCircle = new makeObj('divCircle')

oBut[0].moveIt(250,100)

oBut[1].moveIt(310,100)

oBut[2].moveIt(370,100)

oBut[3].moveIt(420,100)

oBut[4].moveIt(480,100)

oCircle.moveIt(circleXstart,circleYstart)

//Showing the buttons

for(var i=0; i<=numItems; i++){

oBut[i].showIt()

}

}

var slidTim = 100;

var active = -1

function sbmover(num){

clearTimeout(slidTim)

oCircle.slideactive = false

oCircle.slideIt(oBut[num].x+circleXoffset,oBut[num].y+circleYoffset,circlePXspeed,circleTspeed)

}

function sbmout(num){

clearTimeout(slidTim)

oCircle.slideactive = false

if (active>-1 && circleStay) oCircle.slideIt(oBut[active].x+circleXoffset,oBut[active].y+circleYoffset,circlePXspeed,circleTspeed)

else oCircle.slideIt(circleXstart,circleYstart,circlePXspeed,circleTspeed)

}

function changeListing(num){

active = num

}

if(bw.bw) onload = slideballInit;

</script>

<div id="divButton0" class="clButtons">

<a href="#" onmouseover="sbmover(0)" onmouseout="sbmout(0)" onclick="changeListing(0); return false">链接1</a>

</div>

<div id="divButton1" class="clButtons">

<a href="#" onmouseover="sbmover(1)" onmouseout="sbmout(1)" onclick="changeListing(1); return false">链接2</a>

</div>

<div id="divButton2" class="clButtons">

<a href="#" onmouseover="sbmover(2)" onmouseout="sbmout(2)" onclick="changeListing(2); return false">链接3</a>

</div>

<div id="divButton3" class="clButtons">

<a href="#" onmouseover="sbmover(3)" onmouseout="sbmout(3)" onclick="changeListing(3); return false">链接4</a>

</div>

<div id="divButton4" class="clButtons">

<a href="#" onmouseover="sbmover(4)" onmouseout="sbmout(4)" onclick="changeListing(4); return false">链接5</a>

</div>

<div id="divCircle">

<img src="../wydh/images/149/trail4.gif" width="22" height="21" border="0">

</div>

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有