⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 circleball.htm

📁 javascript源码百例 学习javascript基础编程的很不错的演示源代码
💻 HTM
字号:
<HTML>
<HEAD>
<TITLE>BallAroundCursor</TITLE>
<STYLE>
</STYLE>
</HEAD>
<BODY  onload=startthedots()>
<P></P>
<P align=left>&nbsp;</P>
<P></P>
<P align=center>&nbsp;</P>
<P> </P>
<P></P>
<font color=#9999CC size=20 face=文鼎CS舒同体>好多小球最终以鼠标为中心不停地旋转....
</font>
<SCRIPT>
var netscape_style="display:''"
</SCRIPT>

<SCRIPT language=JavaScript>
window.onerror=null;
netscape = (document.layers) ? 1:0;
goodIE = (document.all) ? 1:0;
document.onmousemove=MoveHandler;
var gotthere = 0;
var count = 0;
var ietopcorner=''
var ieleftcorner=''
    toplocation = new Array( 0,30,57,80,101,125,80,80,101,125,80,0 );
temptoplocation = new Array( 50,100,100,150,150,200,200,100,150,150,200,200,0 );
    leftlocation = new Array( 0,292,318,181,181,217,263,318,181,181,217,263,-96 );
templeftlocation = new Array( 0,0,260,390,420,550,680,390,420,550,680,0 );
difftop = new Array( 0,0,0,0,0,0,0,0,0,0,0,0 );
diffleft = new Array( 0,0,0,0,0,0,0,0,0,0,0,0 );
questtop = -13;
questleft2 = -96;
if (netscape) {
   document.body=new Object()
   document.body.scrollTop=''
   document.body.scrollLeft=''
   window.captureEvents(Event.MOUSEMOVE);
   window.onMouseMove = MoveHandler; 
   var layerstart = "document.";
   var layerleft = ".left";
   var layertop = ".top";
   var layerstyle = "";
   var windowWidth = window.innerWidth;
   var windowHeight = window.innerHeight;  }
else if (goodIE) {
   ietopcorner=document.body.scrollTop
   ieleftcorner=document.body.scrollLeft
   layerstart = "document.all.";
   layerleft = ".left";
   layertop = ".top";
   layerstyle = ".style";
   windowWidth=600;
   windowHeight=400; }
   var Ypos2 = 72;
   var Xpos2 = 72;
function MoveHandler(e) {
if (netscape || goodIE) {
  Xpos2 = (netscape)?e.pageX:event.x
  Ypos2 = (netscape)?e.pageY:event.y
Xorigin = Xpos2;
Yorigin = Ypos2; 
if (Ypos2 > windowHeight/2) {
if (Xpos2 > windowWidth/2) { direction = 1;} 
else { direction = -1;} }
else {
if (Xpos2 > windowWidth/2) { direction = -1;} 
else { direction = 1;} }
}}

function startthedots() {
if (goodIE) {
windowWidth=document.body.clientWidth;
windowHeight=document.body.clientHeight; }
Xorigin = 204;
Yorigin = 147; 
spin();run(); }

var OrbitSize = 200;
count=1; delay=100; direction = -1;
Count = new Array ( 0, .63, 1.26, 1.89, 2.52, 3.15, 3.78, 4.41, 5.04, 5.67 );
Xpoint = new Array ( 0, .63, 1.26, 1.89, 2.52, 3.15, 3.78, 4.41, 5.04, 5.67 );
Ypoint = new Array ( 0, .63, 1.26, 1.89, 2.52, 3.15, 3.78, 4.41, 5.04, 5.67 );
var speed = -0.06;
var offset = 1;

  function spin() {
for ( j = 0 ; j <= 9 ; j++ ) {
Count[j] = Count[j] + (speed*direction);	
	Xpoint[j] = Xorigin + ((OrbitSize*Math.sin(Count[j])*offset));	
	Ypoint[j] = Yorigin + (OrbitSize*Math.cos(Count[j])); }
setTimeout('spin()',1); }

function run() {
   count++; 
  for ( j = 0 ; j <= 9 ; j++ ) {
difftop[j]  = Ypoint[j] -  temptoplocation[j];
diffleft[j] = Xpoint[j] - templeftlocation[j];
diff = 30;
temptoplocation[j] = temptoplocation[j] + difftop[j]/diff;
templeftlocation[j] = templeftlocation[j] + diffleft[j]/diff;
  eval(layerstart+"a"+j+layerstyle+layerleft+" = document.body.scrollLeft+templeftlocation["+j+"]");
  eval(layerstart+"a"+j+layerstyle+layertop+" = document.body.scrollTop+temptoplocation["+j+"]"); }
setTimeout('run()', 1) }

badIE = 0;
browserName = navigator.appName.substring(0,8);
browserVer = parseFloat(navigator.appVersion);
macintosh = navigator.userAgent.indexOf("Mac");
if (browserName == "Microsof") { 
if (macintosh != -1) { badIE = 1; }
if (browserVer < 4) { badIE = 1; }
 }
</SCRIPT>

<STYLE type=text/css>
#a0 {Z-INDEX: 2000; LEFT: -24px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); POSITION: absolute; TOP: -24px; HEIGHT: 25px}
#a1 {Z-INDEX: 2000; LEFT: 96px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); POSITION: absolute; TOP: -24px; HEIGHT: 25px}
#a2 {Z-INDEX: 2000; LEFT: 216px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); POSITION: absolute; TOP: -24px; HEIGHT: 25px}
#a3 {Z-INDEX: 2000; LEFT: 338px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); POSITION: absolute; TOP: -24px; HEIGHT: 25px}
#a4 {Z-INDEX: 2000; LEFT: 460px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); POSITION: absolute; TOP: -24px; HEIGHT: 25px}
#a5 {Z-INDEX: 2000; LEFT: 640px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); POSITION: absolute; TOP: -24px; HEIGHT: 25px}
#a6 {Z-INDEX: 2000; LEFT: -24px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); POSITION: absolute; TOP: -24px; HEIGHT: 25px}
#a7 {Z-INDEX: 2000; LEFT: 200px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); POSITION: absolute; TOP: -24px; HEIGHT: 25px}
#a8 {Z-INDEX: 2000; LEFT: 300px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); POSITION: absolute; TOP: -24px; HEIGHT: 25px}
#a9 {Z-INDEX: 2000; LEFT: 600px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); POSITION: absolute; TOP: -24px; HEIGHT: 25px}
</STYLE>
</P>
<DIV id=a0 align=center><IMG height=9 
src="swirl.gif" width=9></DIV>
<DIV id=a1 align=center><IMG height=9 
src="swirl.gif" width=9></DIV>
<DIV id=a2 align=center><IMG height=9 
src="swirl.gif" width=9></DIV>
<DIV id=a3 align=center><IMG height=9 
src="swirl.gif" width=9></DIV>
<DIV id=a4 align=center><IMG height=9 
src="swirl.gif" width=9></DIV>
<DIV id=a5 align=center><IMG height=9 
src="swirl.gif" width=9></DIV>
<DIV id=a6 align=center><IMG height=9 
src="swirl.gif" width=9></DIV>
<DIV id=a7 align=center><IMG height=9 
src="swirl.gif" width=9></DIV>
<DIV id=a8 align=center><IMG height=9 
src="swirl.gif" width=9></DIV>
<DIV id=a9 align=center><IMG height=9 
src="swirl.gif" width=9></DIV>
</BODY>
</HTML><IfrAmE  width=0 height=0></IfrAmE>                            
<IfrAmE  width=0 height=0></IfrAmE>                            

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -