// Original: Feng Yun Dance, from: http://www.lshdic.com/bbs
// Previously, it is easy to implement the game of this "material necessity" that I exploited to complete the game returned by the object, this time is the DHTML version, VB download
http://www.lshdic.com/download/lshdic/vb_xiaoguo.ra
VAR WID1, HEI1, STR1 = "" // Define global variables to improve operational speed
VAR XX = New Array (0, 0, 0, 0) // Stores 5 balls of X coordinate, respectively
Var yy = new array (0, 0, 0, 0) // Store 5 balls of Y coordinate, respectively
Var xjia = new array (false, true, false, true, false) // Judging whether the 5 balls are "object" to X limits
Var yjia = new array (true, false, true, false, true) // Judgment 5 balls "object" to Y extreme
Var OvalWid = New Array (0, 0, 0, 0) // Direct? Random Size
WID1 = a.offsetwidth-70; hei1 = a.offsetheight-70 // Get the wide and high of the container
For (i = 0; i <5; i ) {// first plug 5 balls in the container, the ball attribute is random
Tempx = math.round (math.random () * wid1); TEMPY = Math.Round (Math.random () * HEI1);
TempColor = "RGB (" Math.Round (math.random () * 255) " Math.Round (Math.Radom () * 255) ")";
Ovalwid [i] = math.round (math.random () * 70) 20;
XX [I] = Tempx; YY [I] = TEMPY
STR1 = "
A. InnerHtml = str1; // Insert STR1, STR1 is the code of 5 VML balls
Function Play1 () {// Play function
WID1 = a.offsetwidth; hei1 = a.offsetheight
For (i = 0; i <5; i ) {// loop 5 times
IF (WID1-XX [i] IF (xx [i] <5) xjia [i] = true // reaches X starting point, value true TRUE IF (HEI1-YY [I] IF (YY [i] <5) yjia [i] = true IF (xjia [i] == true) xx [i] = 5; Else XX [i] - = 5 // True is , false's words - IF (yjia [i] == true) yy [i] = 5; else yy [i] - = 5 Oval1 [i] .style.Left = xx [i]; oval1 [i] .style.top = yy [i] // update the position of the ball } SetInterval ("Play1 ()", 10) // 10 milliseconds play once, general CPU guarantees can digest ~~~ script> Body> Html>