POSKAKUJUCE LOPTICKY

ID
Nazov / Name:
Popis / Description:
Dlzka / Length:
Testovane pod / Tested under:

 

144
p144.html / p144.zip
Lopticky, ktore sa odrazaju po obrazovke
2109b
NN 4.04

UKAZKA / CLICK HERE

Zdrojovy tvar / Source code:

<HTML> <HEAD> <TITLE>JavaScript DESTINATION - P144</TITLE> <SCRIPT LANGUAGE= "JavaScript1.2"> <!-- var grnX=2; var grnY=2.5; var redX=2; var redY=-2; var colourX=2; var colourY=3; window.flickerFree=true; function moveBall(ball, offsetX, offsetY) { if (( ball.left < 400 ) && ( ball.left > 0 )) { if (( ball.top < 200 ) && ( ball.top > 0 )) { ball.offset( offsetX, offsetY ); return 'ok'; } else { return 'topBoundary'; } } else { return 'leftBoundary'; } } function startTheBallRolling() { if ( moveBall( green, grnX, grnY ) == 'topBoundary' ){ grnY = 0 - grnY; green.offset( grnX, grnY ); } else { if ( moveBall( green, grnX, grnY ) == 'leftBoundary' ) { grnX = 0 - grnX; green.offset( grnX, grnY ); } } if ( moveBall( red, redX, redY ) == 'topBoundary' ){ redY = 0 - redY; red.offset( redX, redY ); } else { if ( moveBall( red, redX, redY ) == 'leftBoundary' ) { redX = 0 - redX; red.offset( redX, redY ); } } if ( moveBall( colour, colourX, colourY ) == 'topBoundary' ){ colourY = 0 - colourY; colour.offset( colourX, colourY ); } else { if ( moveBall( colour, colourX, colourY ) == 'leftBoundary' ) { colourX = 0 - colourX; colour.offset( colourX, colourY ); } } setTimeout("startTheBallRolling()", 2); } //--> </SCRIPT> </HEAD> <BODY onLoad="startTheBallRolling()"> <LAYER NAME="greenball" WIDTH=13 HEIGHT=13 LEFT=5 TOP=1> <IMG SRC="images/ball_grn.gif"> </LAYER> <LAYER NAME="redball" WIDTH=13 HEIGHT=13 LEFT=25 TOP=135> <IMG SRC="images/ball_red.gif"> </LAYER> <LAYER NAME="colourball" WIDTH=13 HEIGHT=13 LEFT=255 TOP=115> <IMG SRC="images/ball_clr.gif"> </LAYER> <SCRIPT LANGUAGE="JavaScript1.2"> <!-- var green = document.layers["greenball"]; var red = document.layers['redball']; var colour = document.layers['colourball']; //--> </SCRIPT> </BODY> </HTML>
[ Navrat / BACK ]