<!--在<BODY>與</BODY>之間加入下列語法-->
<script language="JavaScript">
<!--
Image0=new Image();
Image0.src="..images/pooh.gif";//Type your image name here!!
var ImaGe="..images/pooh.gif"; //And here!!
var BufferY=-163;//Your image height!!
var BufferX=-76; //Your image width!!
function Curve(){
abc=new Array(1,-1,2,-2,3,-3,0,1,-1)
for (i=0; i < abc.length; i++)
{var C=Math.round(Math.random()*[i])}
howbend=abc[C];
setTimeout('Curve()',1900);
return howbend;
}
ypos=0;
xpos=0;
verticalbounce=0;
horizontalbounce=0;
degree = 60;
function MoveRandom(){
PathBend=degree+=howbend;
y = Math.round(3*Math.sin(PathBend*Math.PI/180));
x = Math.round(5*Math.cos(PathBend*Math.PI/180));
xpos+=x
ypos+=y
verticalbounce=180-degree;
horizontalbounce=0-degree;
if (document.layers){
if ((xpos > window.innerWidth+BufferX) || (xpos < 1)) degree = verticalbounce;
if ((ypos > window.innerHeight+BufferY) || (ypos < 1)) degree=horizontalbounce;
if ((xpos < 1) && (ypos < 1)) degree = 45;
if ((xpos < 1) && (ypos > window.innerHeight+BufferY)) degree = 315;
if ((xpos > window.innerWidth+BufferX) && (ypos > window.innerHeight+BufferY))
degree = 225;
if ((xpos > window.innerWidth+BufferX) && (ypos < 1)) degree = 135;
if ((xpos < 2) || (xpos > window.innerWidth+BufferX-5)) howbend=0;
if ((ypos < 2) || (ypos > window.innerHeight+BufferY-5)) howbend=0;
}
else if (document.all){
if ((xpos > document.body.clientWidth+BufferX) || (xpos < 1)) degree =
verticalbounce;
if ((ypos > document.body.clientHeight+BufferY) || (ypos < 1)) degree=horizontalbounce;
if ((xpos < 1) && (ypos < 1)) degree = 45;
if ((xpos < 1) && (ypos > document.body.clientHeight+BufferY)) degree = 315;
if ((xpos > document.body.clientWidth+BufferX) && (ypos >
document.body.clientHeight+BufferY)) degree = 225;
if ((xpos > document.body.clientWidth+BufferX) && (ypos < 1)) degree = 135;
if ((xpos < 2) || (xpos > document.body.clientWidth+BufferX-5)) howbend=0;
if ((ypos < 2) || (ypos > document.body.clientHeight+BufferY-5)) howbend=0;
}
//window.status=howbend+' '+degree;
T=setTimeout('MoveRandom()',30);
if (document.layers){
document.PoInTeRs.top=ypos+window.pageYOffset;
document.PoInTeRs.left=xpos+window.pageXOffset;
}
else if (document.all){
pOiNtErS.all.me.all[0].style.top=ypos+document.body.scrollTop ;
pOiNtErS.all.me.all[0].style.left=xpos+document.body.scrollLeft;
}
}
function sTaRt(){
Curve();
MoveRandom();
}
if (document.layers)
{document.write("<LAYER NAME='PoInTeRs' LEFT=0 TOP=0><img src="+ImaGe+"></LAYER>")}
else if (document.all)
{document.write("<div id='pOiNtErS' style='position:absolute;top:0px;left:0px'>"
+"<div id='me' style='position:relative;top:0px;left:0px'>"
+"<img src='"+ImaGe+"' style='position:absolute;top:0px;left:0px'>"
+"</div>"
+"</div>")}
if (document.all||document.layers){
window.onload = sTaRt;
window.onresize = new Function("ypos=10;xpos=10");
}
//-->
</script>
{義工語法範本效果}