我想定义三个动作:静止,上下移,平移,怎么调用这三个faction呢?
<html>
<head>
<title>snowpieces</title>
<meta http-equiv="Countent-Type"content="text/html;charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="start()" onLoad="fall()">
<img src="file:///F|/biyesheji/cangku.jpg" width="406" height="303">
<script language="JavaScript">
<!-- Begin
Amount=2;
grphcs=new Array(1)
grphcs[0]="car1.gif"
//grphcs[1]="snow2.gif"
//grphcs[2]="snow3.gif"
//grphcs[3]="snow4.gif"
//grphcs[4]="snow5.gif"
Ypos=new Array();
Xpos=new Array();
Speed=new Array();
Step=new Array();
Cstep=new Array();
ns=(document.layers)?1:0;
if(ns)
 {
   for (i=0;i<Amount;i++)
    {
     var P=Math.floor(Math.random()*grphcs.length);
     rndPic=grphcs[P];
     document.write("<LAYER NAME='sn"+i+"'LEFT=0 TOP=0><img src="+rndPic+"></LAYER>");
    }
 }
else
{
  document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
   for (i=0;i<Amount;i++)
    {
     var P=Math.floor(Math.random()*grphcs.length);
     rndPic=grphcs[P];
     document.write('<img id="si"src="'+rndPic+'"style="position:absolute;top:0px;left:0px">');
    }
document.write('</div></div>');
}
WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;
WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;
for(i=0;i<Amount;i++)
{   
Ypos[i]=188+29.5*0;//Math.round(Math.random()*WinHeight);
Xpos[i]=4+38*0;//Math.round(Math.random()*WinWidth);
//Speed[i]=4.3;//Math.random()*5+1.5;
//Cstep[i]=0;
//Step[i]=20;//Math.random()*0.1+0.05;
//document.write(Step[i]);
//if (Xpos[i]=4,Ypos[i]=188)goto p2;

}
p1:function start()
{
var WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;
    var WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;
var hscrll=(document.layers)?window.pageYOffset:document.body.scrollTop;
var wscrll=(document.layers)?window.pageXOffset:document.body.scrollLeft;
for(i=0;i<Amount;i++)
{
sy=0;//Speed[i]*1.5;
sx=0;//*Math.cos(Cstep[i]);
Ypos[i]+=sy;
Xpos[i]+=sx;
if(Ypos[i]>WinHeight)
{
Ypos[i]=-60;
Xpos[i]=Math.round(Math.random()*WinWidth);
Speed[i]=Math.random()*5+1.5;
}
if(ns)
{
document.layers['sn'+i].left=Xpos[i];
document.layers['sn'+i].top=Ypos[i]+hscrll;
}
else
{
si[i].style.pixelLeft=Xpos[i];
si[i].style.pixelTop=Ypos[i]+hscrll;
}
Cstep[i]+=Step[i];
}
setTimeout('start()',30);
}p2:function fall()
{
var WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;
    var WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;
var hscrll=(document.layers)?window.pageYOffset:document.body.scrollTop;
var wscrll=(document.layers)?window.pageXOffset:document.body.scrollLeft;
for(i=0;i<Amount;i++)
{
sy=5;//Speed[i]*1.5;
sx=0;//*Math.cos(Cstep[i]);
Ypos[i]+=sy;
Xpos[i]+=sx;
if(Ypos[i]>WinHeight)
{
Ypos[i]=-60;
Xpos[i]=Math.round(Math.random()*WinWidth);
Speed[i]=Math.random()*5+1.5;
}
if(ns)
{
document.layers['sn'+i].left=Xpos[i];
document.layers['sn'+i].top=Ypos[i]+hscrll;
}
else
{
si[i].style.pixelLeft=Xpos[i];
si[i].style.pixelTop=Ypos[i]+hscrll;
}
Cstep[i]+=Step[i];
}
setTimeout('fall()',30);
}
p3:function move()
{
var WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;
    var WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;
var hscrll=(document.layers)?window.pageYOffset:document.body.scrollTop;
var wscrll=(document.layers)?window.pageXOffset:document.body.scrollLeft;
for(i=0;i<Amount;i++)
{
sy=0;//Speed[i]*1.5;
sx=1;//*Math.cos(Cstep[i]);
Ypos[i]+=sy;
Xpos[i]+=sx;
if(Ypos[i]>WinHeight)
{
Ypos[i]=-60;
Xpos[i]=Math.round(Math.random()*WinWidth);
Speed[i]=Math.random()*5+1.5;
}
if(ns)
{
document.layers['sn'+i].left=Xpos[i];
document.layers['sn'+i].top=Ypos[i]+hscrll;
}
else
{
si[i].style.pixelLeft=Xpos[i];
si[i].style.pixelTop=Ypos[i]+hscrll;
}
Cstep[i]+=Step[i];
}
setTimeout('fall()',30);
}
 End -->
</script>
</body>
</html>