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

📄 带按钮的萤火虫鼠标menubug.txt

📁 JavaScript特效(新)这里有许多的JAVA特效.供学者参考
💻 TXT
字号:
先将以下代码复制到<head></head>之间:

<script LANGUAGE="javascript1.2">
// This part should be placed in a separate file. Unfortunately, I wasn't able
// to upload when I used two files.

var fixedStars = true; // let them be fixed.

// determine browser and version.
function Is() {
  var agent = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);
  this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
  this.ns4 = (this.ns && (this.major >= 4));
  this.ie   = (agent.indexOf("msie") != -1);
  this.ie4  = (this.ie && (this.major >= 4));
}

var is = new Is()
if (is.ns4) {
  doc = "document";
  sty = "";
  htm = ".document";
  xpos = "evnt.pageX";
  ypos = "evnt.pageY";
}
else if (is.ie4) {
  doc = "document.all";
  sty = ".style";
  htm = "";
  xpos = "event.x";
  ypos = "event.y";
}

// put all object at right places before make them visible. 
// called when onLoad.
function layerSetup() {
  A_Lyr = eval(doc + '["LayerA"]' + sty);
  A_Lyr.left = (available_width)/2;
  A_Lyr.top = (available_height-145)/2;
  B_Lyr = eval(doc + '["LayerB"]' + sty);
  B_Lyr.left = (available_width)/2;
  B_Lyr.top = (available_height-145)/2;
  C_Lyr = eval(doc + '["LayerC"]' + sty);
  C_Lyr.left = (available_width)/2;
  C_Lyr.top = (available_height-145)/2;
  D_Lyr = eval(doc + '["LayerD"]' + sty);
  D_Lyr.left = (available_width)/2;
  D_Lyr.top = (available_height-145)/2;
  E_Lyr = eval(doc + '["LayerE"]' + sty);
  E_Lyr.left = (available_width)/2;
  E_Lyr.top = (available_height-145)/2;
  F_Lyr = eval(doc + '["LayerF"]' + sty);
  F_Lyr.left = (available_width)/2;
  F_Lyr.top = (available_height-145)/2;
  G_Lyr = eval(doc + '["LayerG"]' + sty);
  G_Lyr.left = (available_width)/2;
  G_Lyr.top = (available_height-145)/2;

  pathLyr = eval(doc + '["pathLayer"]' + sty);
  pathLyr.left = 3;
  pathLyr.top = 0;

  visibilitySetup();
}

// make all objects visible.
function visibilitySetup() {
  A_Lyr.visibility = "visible";
  B_Lyr.visibility = "visible";
  C_Lyr.visibility = "visible";
  D_Lyr.visibility = "visible";
  E_Lyr.visibility = "visible";
  F_Lyr.visibility = "visible";
  G_Lyr.visibility = "visible";
  pathLyr.visibility = "visible";

  xPosition = parseInt(A_Lyr.left);
  yPosition = parseInt(A_Lyr.top);

  eventSetup();
  moveStar();
}

var delay = 40;
var step = 0.2;
var currStep = 0;
var xPosition = 0;
var yPosition = 0;
var xFix = 0;
var yFix = 0;

if (is.ns4) {
  window.captureEvents(Event.MOUSEMOVE || Event.MOUSEDOWN);
}

function MoveHandler(evnt) {
  if (is.ns4) {
    if (fixedStars) {
      xPosition = evnt.pageX;
      yPosition = evnt.pageY;
	   }
    else {
      xPosition = xFix;
      yPosition = yFix;
    }
  }
}

function DownHandler(evnt) {
  if (is.ns4) {
     xFix = eval(xpos); 
     yFix = eval(ypos);
  }
}

if (is.ns4) window.onMouseMove = MoveHandler;
if (is.ns4) window.onMouseDown = DownHandler;

// path of star movement.
function moveStar() {
  var j = 0;
  xBase = available_width/16;
  yBase = available_height/16;
  A_Lyr.top  = yPosition + Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  A_Lyr.left = xPosition + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  j++;
  B_Lyr.top  = yPosition + Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  B_Lyr.left = xPosition + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  j++;
  C_Lyr.top  = yPosition + Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  C_Lyr.left = xPosition + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  j++;
  D_Lyr.top  = yPosition + Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  D_Lyr.left = xPosition + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  j++;
  E_Lyr.top  = yPosition + Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  E_Lyr.left = xPosition + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  j++;
  F_Lyr.top  = yPosition + Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  F_Lyr.left = xPosition + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  j++;
  G_Lyr.top  = yPosition + Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  G_Lyr.left = xPosition + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep+j*25)/10);
  j = 0;
  currStep += step;
  setTimeout("moveStar()", delay);  // recursive call
}

function eventSetup() {
    pathArea = eval(doc + '["pathLayer"]' + htm);
    pathArea.onmousemove = mouseMove;
    pathArea.onmousedown = mouseDown;
    if (is.ns4) pathArea.captureEvents(Event.MOUSEMOVE);
    if (is.ns4) pathArea.captureEvents(Event.MOUSEDOWN);
}

// get the position when mouse move.
function mouseMove(evnt) {
  if (fixedStars) {
    xPosition = eval(xpos);
    yPosition = eval(ypos);
  }
  else {
    xPosition = xFix; 
    yPosition = yFix;
  }
}

// get the position when mouse down.
function mouseDown(evnt){
  xFix = eval(xpos); yFix = eval(ypos);
}

// change the speed.
function chngitsspeed() {
  if (isNumber(document.formular.chngspeed.value) ==  1) 
    delay = document.formular.chngspeed.value;
}

// check if the input is a positive number.
function isNumber(inptVal) {
  inptStr = "" + inptVal;
  var oneChar;
  for (var i = 0; i < inptStr.length; i++) {
    oneChar = inptStr.charAt(i);
    if (oneChar < "0" || oneChar > "9") return 0;
  }
  return 1;
}

// let stars fixed or fly.
function chngf(v) {
  if (v == 'starfix') {
    fixedStars = false; 
     xFix = xPosition; 
     yFix = yPosition;
  }
  else  fixedStars = true;
}
</script>
<style TYPE="text/css">
.a {color: red;   font-weight: 400; font-size: 20pt;}
.b {color: blue;  font-weight: 400; font-size: 20pt;}
.c {color: green; font-weight: 400; font-size: 20pt;}
.d {color: orange;font-weight: 400; font-size: 20pt;}
.e {color: black; font-weight: 400; font-size: 20pt;}
.f {color: yellow;font-weight: 400; font-size: 20pt;}
.g {color: gray;  font-weight: 400; font-size: 20pt;}
</style>



再将以下代码复制到<body></body>之间:
<body MARGINWIDTH="0" MARGINHEIGHT="0" onLoad="
   if (is.ns4) {
     available_width=innerWidth;
     available_height=innerHeight;
     layerSetup();
   } else if(is.ie4) {
     available_width=document.body.clientWidth;
     available_height=document.body.clientHeight;
     layerSetup();
   }
" onResize="history.go(0)">


<div ID="LayerA" STYLE="fontSize: 25px; color: red; HEIGHT: 1px; LEFT: 0px; POSITION: absolute; TOP: 10px; VISIBILITY: hidden; WIDTH: 1px; Z-INDEX: 1" >
  <center><font class="a">.</font></center></div>

<div ID="LayerB" STYLE="HEIGHT: 1px; LEFT: 10px; POSITION: absolute; TOP: 10px; VISIBILITY: hidden; WIDTH: 1px; Z-INDEX: 2" >
  <center><font class="b">.</font></center></div>

<div ID="LayerC" STYLE="HEIGHT: 1px; LEFT: 10px; POSITION: absolute; TOP: 10px; VISIBILITY: hidden; WIDTH: 1px; Z-INDEX: 3" >
  <center><font class="c">.</font></center></div>

<div ID="LayerD" STYLE="HEIGHT: 1px; LEFT: 10px; POSITION: absolute; TOP: 10px; VISIBILITY: hidden; WIDTH: 1px; Z-INDEX: 4" >
  <center><font class="d">.</font></center></div>

<div ID="LayerE" STYLE="HEIGHT: 1px; LEFT: 10px; POSITION: absolute; TOP: 10px; VISIBILITY: hidden; WIDTH: 1px; Z-INDEX: 5" >
  <center><font class="e">.</font></center></div>

<div ID="LayerF" STYLE="HEIGHT: 1px; LEFT: 10px; POSITION: absolute; TOP: 10px; VISIBILITY: hidden; WIDTH: 1px; Z-INDEX: 6" >
  <center><font class="f">.</font></center></div>

<div ID="LayerG" STYLE="HEIGHT: 1px; LEFT: 10px; POSITION: absolute; TOP: 10px; VISIBILITY: hidden; WIDTH: 1px; Z-INDEX: 7" >
  <center><font class="g">.</font></center></div>

<div ID="pathLayer" STYLE="HEIGHT: 100%; LEFT: 0px; POSITION: absolute; TOP: 0px; VISIBILITY: hidden; WIDTH: 100%; Z-INDEX: 8">
  <div ID="subLayer" STYLE="LEFT: 10px; POSITION: absolute; TOP: 50px; VISIBILITY: visible; WIDTH: 100%; Z-INDEX: 8">
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <form name="formular">
      <p>改变延时数据以改变旋转速度: 
      <input name="chngspeed" size=4 value=10> 
      <input type=button name="chpd" value="Submit" onClick="chngitsspeed()"></p>
      <INPUT TYPE="RADIO" name="fix_fly" onClick="chngf('starfix')">固定位置</INPUT><br>
      <INPUT TYPE="RADIO" name="fix_fly" CHECKED onClick="chngf('starfly')">随鼠标飞舞</INPUT>
      </p>
    </form>
    </p>
  </div>
</div>

⌨️ 快捷键说明

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